I had some trouble creating production and testing environments, but I was in a position where I could make API changes in Appsync, and codegen would pick them up and update my graphql directory.
Now I've made some changes on the production API (Appsync), and amplify codegen
complete with no errors, but the schema and queries are not updated.
amplify status
shows there's an update operation for the API, but my backend API directory is pretty much empty, and I don't want to overwrite what's in Appsync with a amplify push
Help?
This may be related to something I have experienced recently and discussed here.
amplify codegen
seems to have some kind of bug in edge situations, where it does not update queries.
I don't want to push you towards what solved it for me, because I don't know if it's fully related, but I'd like to bring the attention to @swaminator @kaustavghosh06 who helped me out and seems to be tracking this issue.
@RuarriS Did you make the changes using the AppSync console or using Amplify CLI. If the changes were made using Amplify CLI, did you use headless mode to push your changes
@yuth I made the changes using the Appsync console.
We recently update codegen to use local SDL schema instead of downloading introspection schema to support local mocking. You can find out if you are using local SDL schema or introspection schema by looking at <proj-root>/.graphqlconfig.yml
file and looking at if schemaPath
. If its is pointing to backend/api/<api-name>/build/schema.graphql
in which case its using local SDL schema. Otherwise its using introspection schema which it downloads from AppSync service.
If you're using local SDL schema and want to switch to introspection schema, then you will have to update your codgen configuration. Run the following command at the root of your project
$ amplify codegen remove
$ amplify-dev add codegen --apiId <API ID>
Thank you – that worked (with amplify, not amplify-dev)
I am experiencing this issue. Everything has been working fine for me for over a year.
Now when I successsfully run amplify push, my changes seem to go through but then they are not update on the back end.
I try to add items to my schema and they arent getting updated from the CLI.
I also am having a similar issue as this. I manually updated schema.graphql in my project, did amplify push
, and then ran a Gradle build. This didn't update schema.json, nor did it update build/schema.graphql. I then ran amplify api gql-compile
, which didn't update build/schema.graphql. I had to manually go into build/schema.graphql and make changes. Only then did my schema.json and the resulting codegen files get updated.
This worked for me:
Make sure you have the latest API pulled. After deleting files graphql/mutations.js and graphql/queries.js I ran amplify codegen add
and followed the prompts.
Files were regenerated.
Most helpful comment
We recently update codegen to use local SDL schema instead of downloading introspection schema to support local mocking. You can find out if you are using local SDL schema or introspection schema by looking at
<proj-root>/.graphqlconfig.yml
file and looking at ifschemaPath
. If its is pointing tobackend/api/<api-name>/build/schema.graphql
in which case its using local SDL schema. Otherwise its using introspection schema which it downloads from AppSync service.If you're using local SDL schema and want to switch to introspection schema, then you will have to update your codgen configuration. Run the following command at the root of your project