amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Pushing amplify appsync api changes

Open myfairshare opened this issue 6 years ago • 5 comments

Which Category is your question related to? Pushing api changes

Amplify CLI Version 4.21.0

What AWS Services are you utilizing? amplify

Provide additional details e.g. code snippets Hello, I am fairly new to AWS. I have been building a project using amplify appsync and datastore. Everything going ok but I was just working with just one model in my graphql schema to begin with. I was following a Nader Dabit video to get off the ground.

I have since built up my schema a lot with more models and indexes so I have gone from one model to around 6 with a few @keys directives.

Today I tried to push my changes and got errors, then I realized in a recent Nader video he mentions pushing more than one @key addition causes errors.

So do I now need to strip back all my changes, push again, then push each new added model and one @key at a time, sounds quite time consuming, but I can live with that.

I have rolled back to my one original model at the moment but my local Indexdb now seems to be a bit out of whack after running my react front end again. It seems to be still picking up the schema changes which I rolled back.

Hope this makes sense, thank you.

myfairshare avatar Jun 03 '20 11:06 myfairshare

@myfairshare after rolling back your model did you run amplify api gql-compile or do an amplify push?

nikhname avatar Jun 03 '20 17:06 nikhname

Hi Nik,

Thanks for you reply. So I commented out all my new models and @key directives in my gql schema and ran amplify push which gave no errors. So I then added subsequent models one at a time minus directives and push them one by one, again no errors. So I have just started adding @key directives one at a time and pushing, again no errors. So I guess i will keep doing that. I also deleted my few bits of data in the aws console, must go back and do for the datastore db also. And of course my react code will need to be updated. Is this bad practice, atleast I now know what to look out for. I just hope my local indexdb works as before, thank you for any tips!

myfairshare avatar Jun 03 '20 17:06 myfairshare

Hi @myfairshare, this is the standard practice at this time. You may also want to take a look at https://docs.amplify.aws/cli/graphql-transformer/directives#evolving-apis-with-key when thinking about making changes to @key in the future

nikhname avatar Jun 08 '20 21:06 nikhname

This issue has been automatically closed because of inactivity. Please open a new issue if you are still encountering problems.

stale[bot] avatar Jun 19 '20 03:06 stale[bot]

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 26 '21 04:05 github-actions[bot]