Search code examples
amazon-web-servicesaws-amplifyaws-appsyncaws-amplify-cli

How to update Amplify with changes from Appsync


I have created an api in my amplify app through the console. Now I've edited both the schema and resolvers in my appsync through aws console UI, but it's not reflected in amplify

I tried amplify pull and amplify gql-compile, but the files aren't updated


Solution

  • Within the AWS Console (aka click-ops via website) you can make changes within the "App settings" of the "AWS Amplify" section. You may NOT drill into the backend sections of your app (API, Authentication, Functions, File storage) to other areas of AWS Console and make changes. Note I say "may not" and not "can not". You can make changes to your backend, but they will be out of sync with the rest of your Amplify managed project and will likely cause problems.

    You may also click the "Launch Studio" button and make changes there to your heart's content. If you make any changes within the Amplify Studio webpages, be sure to do an amplify pull on your local machine to sync up with those changes. And be sure to save/commit any code before you amplify pull as that command can/will overwrite your local files. e.g. If you have a new lambda that's not in the cloud yet, a pull would remove that lambda so things are sync'd up.

    If you made the changes via "aws console" outside the aforementioned safe areas (e.g. over in AppSync console) then you'll probably need to carefully revert those changes via the console and apply them "correctly". By correctly, I mean via the Amplify Studio webpages, Amplify CLI, or by updating your project's CloudFormation or cloud formation override files.

    OH, TLDR; sometimes you can amplify mock to cause Amplify to rebuild the generated files. You can also amplify codegen (doc), but when that gets stuck mock works better. And when the files are acting up as you describe, I just delete them so I know when they're finally regenerated properly.