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

Error with codegen and models preventing API sync #578

Closed
ErnestDaDev opened this issue May 14, 2021 · 5 comments
Closed

Error with codegen and models preventing API sync #578

ErnestDaDev opened this issue May 14, 2021 · 5 comments
Labels
datastore Issues related to the DataStore Category pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days.

Comments

@ErnestDaDev
Copy link

When I use your example for many to many relationships in datastore with this schema

`type Post @model @auth(rules: [{allow: public}]) {
id: ID!
title: String!
rating: Int
status: PostStatus
editors: [PostEditor] @connection(keyName: "byPost", fields: ["id"])
}

type PostEditor @model(queries: null) @key(name: "byPost", fields: ["postID", "editorID"]) @key(name: "byEditor", fields: ["editorID", "postID"]) @auth(rules: [{allow: public}])
{
id: ID!
postID: ID!
editorID: ID!
post: Post! @connection(fields: ["postID"])
editor: AmpUser! @connection(fields: ["editorID"])
}`

API Sync fails and when I checked on the AWS Amplify data section, the table PostsEditor does not get created. and it shows it missing under post.

I am not sure what i am doing wrong.

Screenshot 2021-05-14 at 09 03 11

@HuiSF
Copy link
Member

HuiSF commented Jun 9, 2021

Hi @BesavedTech, thanks for opening the issue.
I have a few questions for you to help me understand the error you encountered.

  1. Were all models generated after via amplify codegen models after you edited schema.graphql, i.e. Did file PostEditor.dart correctly generated in your codebase?
  2. By API sync, you mean push the backend via amplify push? What was the exact error message of the failure you saw?

@Merglobe
Copy link

@HuiSF yes it did and no I mean syncing in the app it self.

@HuiSF
Copy link
Member

HuiSF commented Jun 14, 2021

After making local changes to the GraphQL schema and data models, you would need to push the latest changes to AWS by running amplify push, as you mentioned "PostsEditor does not get created", it sounds like it's out of sync between AWS AppSync and your local changes.

You can check if you have local changes are pending to be pushed by running amplify CLI.

@HuiSF HuiSF added the datastore Issues related to the DataStore Category label Jun 14, 2021
@HuiSF HuiSF added the pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days. label Jul 28, 2021
@offlineprogrammer
Copy link
Contributor

Hi @Merglobe

I am closing this issue for now as we didn't hear from you
We can reopen it if you are still facing the issue and when you provide more details

Regards
Mo

@b-cancel
Copy link

This is a bug report I just filed that includes a couple of bugs I found and the workarounds to each
after reading your bug report I think it could help others that might land on this page
#822

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore Issues related to the DataStore Category pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days.
Projects
None yet
Development

No branches or pull requests

5 participants