Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataStore Bug please resolve #3502

Closed
jaymeen-unadkat-differenz opened this issue Feb 7, 2024 · 3 comments
Closed

DataStore Bug please resolve #3502

jaymeen-unadkat-differenz opened this issue Feb 7, 2024 · 3 comments
Labels
bug Something isn't working datastore Issues related to the DataStore category

Comments

@jaymeen-unadkat-differenz
Copy link

jaymeen-unadkat-differenz commented Feb 7, 2024

Describe the bug

Facing this issue in iOS

onUpdateValueListener: data(Swift.Result<AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>, Amplify.GraphQLResponseError<AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>>>.success(AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>(model: AWSPluginsCore.AnyModel(id: ""DRI#2"#"DRI#2"", instance: ImbybeTestDemo.Imbybe(pk: "DRI#2", sk: "DRI#2", gsi1: Optional("master"), gsisk1: Optional("DRI#2"), name: Optional("Drink 121"), description: Optional("drink desc 2"), imageURL: Optional([]), ordersEmail: nil, type: Optional("COCKTAIL"), street: nil, city: nil, state: nil, zipCode: nil, productCost: nil, productCategory: nil, numberOfDrinks: Optional(60), publishDate: nil, expirationDate: nil, eligibleZipCodes: Optional([]), numberOfCampaigns: nil, numberOfOffers: nil, remainingNumberOfCampaigns: nil, productQuantity: nil, primaryProduct: Optional(false), lat: nil, lng: nil, operatingHours: nil, cognitoID: nil, startingNumberOfOffers: nil, remainingNumberOfOffers: nil, campaignStatus: nil, rating: nil, comment: nil, createdAt: Optional(Amplify.Temporal.DateTime(foundationDate: 2024-02-07 10:41:15 +0000, timeZone: Optional(GMT (fixed)))), updatedAt: Optional(Amplify.Temporal.DateTime(foundationDate: 2024-02-07 12:31:09 +0000, timeZone: Optional(GMT (fixed))))), modelName: "Imbybe"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(id: "Imbybe|"DRI#2"#"DRI#2"", deleted: false, lastChangedAt: 1707309069243, version: 7))))
receive(_:): data(Swift.Result<AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>, Amplify.GraphQLResponseError<AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>>>.success(AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>(model: AWSPluginsCore.AnyModel(id: ""DRI#2"#"DRI#2"", instance: ImbybeTestDemo.Imbybe(pk: "DRI#2", sk: "DRI#2", gsi1: Optional("master"), gsisk1: Optional("DRI#2"), name: Optional("Drink 121"), description: Optional("drink desc 2"), imageURL: Optional(", ordersEmail: nil, type: Optional("COCKTAIL"), street: nil, city: nil, state: nil, zipCode: nil, productCost: nil, productCategory: nil, numberOfDrinks: Optional(60), publishDate: nil, expirationDate: nil, eligibleZipCodes: Optional([]), numberOfCampaigns: nil, numberOfOffers: nil, remainingNumberOfCampaigns: nil, productQuantity: nil, primaryProduct: Optional(false), lat: nil, lng: nil, operatingHours: nil, cognitoID: nil, startingNumberOfOffers: nil, remainingNumberOfOffers: nil, campaignStatus: nil, rating: nil, comment: nil, createdAt: Optional(Amplify.Temporal.DateTime(foundationDate: 2024-02-07 10:41:15 +0000, timeZone: Optional(GMT (fixed)))), updatedAt: Optional(Amplify.Temporal.DateTime(foundationDate: 2024-02-07 12:31:09 +0000, timeZone: Optional(GMT (fixed))))), modelName: "Imbybe"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(id: "Imbybe|"DRI#2"#"DRI#2"", deleted: false, lastChangedAt: 1707309069243, version: 7))))
dispose(of subscriptionEvent): data(Swift.Result<AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>, Amplify.GraphQLResponseError<AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>>>.success(AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>(model: AWSPluginsCore.AnyModel(id: ""DRI#2"#"DRI#2"", instance: ImbybeTestDemo.Imbybe(pk: "DRI#2", sk: "DRI#2", gsi1: Optional("master"), gsisk1: Optional("DRI#2"), name: Optional("Drink 121"), description: Optional("drink desc 2"), imageURL: Optional([]), ordersEmail: nil, type: Optional("COCKTAIL"), street: nil, city: nil, state: nil, zipCode: nil, productCost: nil, productCategory: nil, numberOfDrinks: Optional(60), publishDate: nil, expirationDate: nil, eligibleZipCodes: Optional([]), numberOfCampaigns: nil, numberOfOffers: nil, remainingNumberOfCampaigns: nil, productQuantity: nil, primaryProd

Steps To Reproduce

Steps to reproduce the behavior:
1. Go to 'Amplify Console'
2. Click on 'Content -> Data Manager'
3. Update any value in the model
4. See the error in the XCode console

Expected behavior

Data should update properly

Amplify Framework Version

2.25.6

Amplify Categories

DataStore

Dependency manager

Swift PM

Swift version

5.9

CLI version

12.10.1

Xcode version

XCode 15

Relevant log output

No response

Is this a regression?

Yes

Regression additional context

No response

Platforms

No response

OS Version

14.0

Device

Simulator iPhone 11

Specific to simulators

No - Not working anywhere

Additional context

Working correctly on Android

@lawmicha
Copy link
Contributor

lawmicha commented Feb 7, 2024

Hi @jaymeen-unadkat-differenz, thanks for opening the issue, here's the formatted log

onUpdateValueListener: data(
    Swift.Result<
        AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>,
        Amplify.GraphQLResponseError<AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>>
    >.success(
        AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>(
            model: AWSPluginsCore.AnyModel(
                id: ""DRI#2"#"DRI#2"",
                instance: ImbybeTestDemo.Imbybe(
                    pk: "DRI#2",
                    sk: "DRI#2",
                    gsi1: Optional("master"),
                    gsisk1: Optional("DRI#2"),
                    name: Optional("Drink 121"),
                    description: Optional("drink desc 2"),
                    imageURL: Optional([]),
                    ordersEmail: nil,
                    type: Optional("COCKTAIL"),
                    street: nil,
                    city: nil,
                    state: nil,
                    zipCode: nil,
                    productCost: nil,
                    productCategory: nil,
                    numberOfDrinks: Optional(60),
                    publishDate: nil,
                    expirationDate: nil,
                    eligibleZipCodes: Optional([]),
                    numberOfCampaigns: nil,
                    numberOfOffers: nil,
                    remainingNumberOfCampaigns: nil,
                    productQuantity: nil,
                    primaryProduct: Optional(false),
                    lat: nil,
                    lng: nil,
                    operatingHours: nil,
                    cognitoID: nil,
                    startingNumberOfOffers: nil,
                    remainingNumberOfOffers: nil,
                    campaignStatus: nil,
                    rating: nil,
                    comment: nil,
                    createdAt: Optional(
                        Amplify.Temporal.DateTime(
                            foundationDate: 2024-02-07 10:41:15 +0000,
                            timeZone: Optional(GMT (fixed))
                        )
                    ),
                    updatedAt: Optional(
                        Amplify.Temporal.DateTime(
                            foundationDate: 2024-02-07 12:31:09 +0000,
                            timeZone: Optional(GMT (fixed))
                        )
                    )
                ),
                modelName: "Imbybe"
            ),
            syncMetadata: AWSPluginsCore.MutationSyncMetadata(
                id: "Imbybe|"DRI#2"#"DRI#2"",
                deleted: false,
                lastChangedAt: 1707309069243,
                version: 7
            )
        )
    )
)

receive(_:): data(
    Swift.Result<
        AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>,
        Amplify.GraphQLResponseError<AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>>
    >.success(
        AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>(
            model: AWSPluginsCore.AnyModel(
                id: ""DRI#2"#"DRI#2"",
                instance: ImbybeTestDemo.Imbybe(
                    pk: "DRI#2",
                    sk: "DRI#2",
                    gsi1: Optional("master"),
                    gsisk1: Optional("DRI#2"),
                    name: Optional("Drink 121"),
                    description: Optional("drink desc 2"),
                    imageURL: Optional([]),
                    ordersEmail: nil,
                    type: Optional("COCKTAIL"),
                    street: nil,
                    city: nil,
                    state: nil,
                    zipCode: nil,
                    productCost: nil,
                    productCategory: nil,
                    numberOfDrinks: Optional(60),
                    publishDate: nil,
                    expirationDate: nil,
                    eligibleZipCodes: Optional([]),
                    numberOfCampaigns: nil,
                    numberOfOffers: nil,
                    remainingNumberOfCampaigns: nil,
                    productQuantity: nil,
                    primaryProduct: Optional(false),
                    lat: nil,
                    lng: nil,
                    operatingHours: nil,
                    cognitoID: nil,
                    startingNumberOfOffers: nil,
                    remainingNumberOfOffers: nil,
                    campaignStatus: nil,
                    rating: nil,
                    comment: nil,
                    createdAt: Optional(
                        Amplify.Temporal.DateTime(
                            foundationDate: 2024-02-07 10:41:15 +0000,
                            timeZone: Optional(GMT (fixed))
                        )
                    ),
                    updatedAt: Optional(
                        Amplify.Temporal.DateTime(
                            foundationDate: 2024-02-07 12:31:09 +0000,
                            timeZone: Optional(GMT (fixed))
                        )
                    )
                ),
                modelName: "Imbybe"
            ),
            syncMetadata: AWSPluginsCore.MutationSyncMetadata(
                id: "Imbybe|"DRI#2"#"DRI#2"",
                deleted: false,
                lastChangedAt: 1707309069243,
                version: 7
            )
        )
    )
)

dispose(of subscriptionEvent): data(
    Swift.Result<
        AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>,
        Amplify.GraphQLResponseError<AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>>
    >.success(
        AWSPluginsCore.MutationSync<AWSPluginsCore.AnyModel>(
            model: AWSPluginsCore.AnyModel(
                id: ""DRI#2"#"DRI#2"",
                instance: ImbybeTestDemo.Imbybe(
                    pk: "DRI#2",
                    sk: "DRI#2",
                    gsi1: Optional("master"),
                    gsisk1: Optional("DRI#2"),
                    name: Optional("Drink 121"),
                    description: Optional("drink desc 2"),
                    imageURL: Optional([]),
                    ordersEmail: nil,
                    type: Optional("COCKTAIL"),
                    street: nil,
                    city: nil,
                    state: nil,
                    zipCode: nil,
                    productCost: nil,
                    productCategory: nil,
                    numberOfDrinks: Optional(60),
                    publishDate: nil,
                    expirationDate: nil,
                    eligibleZipCodes: Optional([]),
                    numberOfCampaigns: nil,
                    numberOfOffers: nil,
                    remainingNumberOfCampaigns: nil,
                    productQuantity: nil,
                    primaryProd

It doesn't appear to be an error, do you not see the Imbybe models in the local DB?

Can you provide us with the schema of Imbybe and it's connected models if it has any, such as belongsTo/hasMany relationships?

You can see my other response in #3495 regarding Amplify Studio's usability with Amplify Swift. Amplify Swift requires lazy loading enabled for it to be compatible with the subscription events sourced from other platforms.

In cli.json do you have the feature flag generateModelsForLazyLoadAndCustomSelectionSet set to true? If you are setting it to true now, please make sure to re-run amplify codegen models to re-generate the proper files

@lawmicha lawmicha added bug Something isn't working pending-community-response Issue is pending response from the issue requestor datastore Issues related to the DataStore category labels Feb 7, 2024
@lawmicha
Copy link
Contributor

lawmicha commented Feb 8, 2024

duplicate of #3495

@lawmicha lawmicha closed this as completed Feb 8, 2024
@github-actions github-actions bot removed the pending-community-response Issue is pending response from the issue requestor label Feb 8, 2024
Copy link
Contributor

github-actions bot commented Feb 8, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datastore Issues related to the DataStore category
Projects
None yet
Development

No branches or pull requests

2 participants