amplify-cli: Resource is not in the state stackUpdateComplete
Do you want to request a feature or report a bug? Bug
What is the current behavior?
After enabling analytics with auth, and pushing, the user is not able to runamplify auth update
(and select default configuration) and then push without receiving the error "Resource is not in the state stackUpdateComplete"
. When the auth stack in cloudformation is inspected, the following error is observed:
Parameters: [autoVerifiedAttributes, smsVerificationMessage, userpoolClientReadAttributes, mfaTypes, emailVerificationSubject, useDefault, userpoolClientGenerateSecret, mfaConfiguration, userpoolClientLogPolicy, smsAuthenticationMessage, roleExternalId, mfaLambdaLogPolicy, passwordPolicyMinLength, userPoolName, policyName, userpoolClientName, userpoolClientLambdaPolicy, mfaLambdaIAMPolicy, mfaPassRolePolicy, emailVerificationMessage, userpoolClientRefreshTokenValidity, userpoolClientSetAttributes, requiredAttributes, roleName, passwordPolicyCharacters, userpoolClientLambdaRole, defaultPasswordPolicy, mfaLambdaRole] must have values
. (These are userpool attributes, which should all be added since the default auth configuration is adding a userpool to the identity pool that was created when analytics was enabled.)
However, the user’s auth resources’s parameters.json file appears to contain all of these parameters, and their cloudformation template appears to be formed correctly.
UPDATE:
This issue also occurs when running amplify api add
, but with the api stacking being affected instead of the auth stack:
Parameters: [MutationCreateNoteResponse, QueryListNotesResponse, QueryGetNoteRequest, MutationDeleteNoteRequest, QueryGetNoteResponse, QueryListNotesRequest, MutationCreateNoteRequest, schemaGraphql, MutationDeleteNoteResponse, MutationUpdateNoteRequest, MutationUpdateNoteResponse] must have values
Steps to reproduce the issue: This issue occurs intermittently, and the repro steps listed here are provisional. The precise circumstances causing this error are not yet know.
- amplify init (iOS project)
- amplify analytics add (w/ auth)
- amplify push (successful)
- amplify auth update (select default configuration)
- amplify auth push
What is the expected behavior? Auth stack should update appropriately.
Additional environment details
-
OS version (ie Windows 10 build X, macOS Sierra 10.12.6, etc.) macOS
-
Output of
amplify --version
: 0.1.15 -
Did this work in previous versions?: Uncertain, since the issue is intermittent
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 26
- Comments: 79 (12 by maintainers)
This issue should be resolved with the CLI version - 0.1.16.
I’m also getting this error when running amplify push after a schema update. I’m using amplify-cli version 0.1.19.
@michaelcaterisano How many [pairs of] @connection fields were you tweaking in the single update? I believe the issue only occurs when making changes that result in more than 1 GSI create/update/delete on a single table. In the short term, you can get around this issue by breaking up the push into multiple steps where you only change 1 connection at a time. In the long term, I think we can get around these issues with tooling that warns you or, even better, that automatically breaks up the push into multiple steps. I will also take an action item to document this in the amplify docs.
E.G. The CLI works when going from:
to:
It also works when going from:
to:
I noticed that it does fail when trying to add multiple connections to a model type in a single push and the reason is that DynamoDB has a limit on the number of GSIs on a single table that you can touch in a single CloudFormation update stack invocation.
E.G. When trying to go from:
to:
will fail with the error
We are working on bypassing a number of CloudFormation & other service related limits but for now, you can sidestep this issue by breaking your update into multiple steps. For example, we can get the above schema to work by first going from:
to:
and then to:
Possibly caused by use of experimental
amplify delete
feature in project directory prior to re-runningamplify init
.I fixed this by adding a space to my graphql schema file and re-pushing. Still, this is a lingering bug but I hope the above steps will help someone.
FYI the only way I could get rid of this message was to delete aws-amplify from my project then delete the global npm package @aws-amplify/cli. I then reinstalled @aws-amplify/cli, ran amplify configure, then amplify init in my project. Once I added auth I was able to push it again.
Would be great if everyone could provide a screenshot of the logs or just paste the logs out here for us to narrow down the issue - along with the OS used.
Is there a best practice that’s been settled on yet for this error?
😅
Same error with 4.13.2.
Amplify CLI version: 4.13.2 Node version: 13.6.0
Why was this issue closed @kaustavghosh06?
For reference, I was following this tutorial https://www.udemy.com/course/serverless-react-with-aws-amplify/ and I encountered the issue while creating an API via the CLI. Removing and adding auth didn’t work for me, but deleting and reinitialising Amplify worked:
This doesn’t seem to be sustainable workaround as others have mentioned.
Perhaps my Node version is too new? As the
awscloudformation/nested-cloudformation-stack.yml
file lists"Runtime": "nodejs10.x"
. I will downgrade now to 10.19.0 and see if the error occurs again.This was my error log:
@mikeparisstuff thx for the update. I made some material changes to my schema (removed several connection references) and adding them back and then making several updates doesn’t seem practical because I’ve made other code changes based on the new schema changes. When I went into my S3 bucket and it seemed stuff has updated (
updatedAt
time changed). Am I stuck until your fix comes in? Best to just delete and re-start?Also, I’m still trying to figure out how to keep my local resources in sync with changes made in the console. For example, my
schema.graphql
is different in localamplify/backend/api/<apiname>/schema.graphql
and the version in the AWS console. How do I update the local to keep them in sync so when I push it doesn’t overwrite my changes? When I update the files inamplify/backend/api/<apiname>/build/schema.graphql
it gets overridden when I doamplify push
.@mdahlke Can you run
amplify update auth
->Yes, use default configurations
and thenamplify push
? That should hopefully resolve your issue.@rygo6 I was able to reproduce it. So from your amplify/backend/api/myapp/parameters.json file remove all entries except the “AppSyncApiName” key. So your parameters.json should look something like this:
After this do an
ampify push
. I’m working on a fix for this, but you’ll be able to push your graphql API by following the above-mentioned steps in the meanwhile.I have faced the same issue and it was caused by changing the project’s route or name. To solve it open amplify/.config/project-config.json and check projectPath
@kaustavghosh06, @tenerifeonline asked me to let you know that due to project pressure he was forced back to firestore for the current project. He will be watching amplify-cli closely going forward and plans to use it in a future project as it looks extremely promising, keep up the good work. Unfortunately, he lost his graphql schema because the “amplify delete” command removed the schema file and he has currently no time to recreate that file. P.S. It would be great if “amplify delete” would not automatically delete the schema and leave the graphql schema file in the amplify directory.
Is there any form of solution for this problem? Removing and adding API (although even this doesn’t seem to work every time) is not a convenient thing to do whenever this error comes up. Sometimes it can even show up when pushing completely fresh default GraphQL schema to the server! We have to live in a constant fear of the whole application breaking after a simple backend update.
If you are new to amplify, beware that - though it enables you to push/publish and might be the only option left - it will kill your stack / backend. Be sure to do this as a last resort or on a a stack that is pretty fresh.
like @dipjyotimetia suggested npm i -g @aws-amplify/cli worked. But after I also did:
amplify remove auth
Followed byamplify add auth
Then amplify push didn’t give any errors.I’ve been having the same issue. It seems in my case that changing the schema definition fixed the problem. This did not work:
But this did (added
name
field to the Order type):Any ideas why?
This happened to me today AGAIN for the n time, the trick that often works for me is to navigate back to the last successful push and then redeploy that version, that’s easy when you are using the continuous deployment of the amplify, if you are not then you might need to git checkout to that particular commit then push that again, that will update the cloud formation stack to STACK_UPDATE_COMPLETE which is the state you want your cloud formation to be in, then you can just redeploy the latest one that you have.
Before I experienced this error, I had a typo error on my
schema.graphql
which resulted in the build failing (I’m unsure how that got the cloud formation stuck) so I fixed the typo and 🎉 this wild error appeared, so I just navigated back to the last successful deployment, redeployed that, took a coffee break (got a girlfriend, got married, had a baby, when the baby was in college, I) came back to redeploy the fix for the typo.It’s worth noting that in some cases, like this case for me, the error is actually not what was said, the very bottom of the logs said Resource is not in the state stackUpdateComplete message but when I scrolled up the actual error is
CREATE_FAILED
, a function that I created failed to be created on the cloud formation side, so it would be useful to scan through the logs and see what actually happened.It’s look like a merging problem. Save your local schema. Run:
The originial schema will be deleted !
Update the schema from the copy you have created. Then run:
Multiply API configuration can be an issue after doing such of operation. You need to delete the old graph settings on the following file (Android): app/src/main/res/raw/amplifyconfiguration.json
@charleslouis Thanks. Since my project is new, I just recreated the project. If I meet this problem again, I will definitely check it.
I ran
amplify function update
and updated access to other resources in one function and it passed. You can still runamplify function update
again to go back to previous state.My issue was related to
amplify storage
, I said yes to the Lambda option but did not have a function for it, so I ranamplify update storage
and change the option to not have Lambda, no really useful error was showed, I manage to push after.I solved the issue by following @iqdev-ca and @dipjyotimetia , but after installing aws-amplify/cli I deleted amplify from my directory and reinitialized. These were the exact steps
I ran the command that @dipjyotimetia suggested:
npm i -g @aws-amplify/cli
I then deleted amplify by:
amplify delete
I then initialized amplify, added auth, and pushed:
amplify init
amplify add auth
amplify push
This finally solved the issue!!
I have been stuck here for couple of days and could not move on with my project due to this error. Any idea how to solve it?
I’ve to solve the issue like @mikeparisstuff mentioned, but this didn’t worked for me. What solved my Problem was to reset the “Read/write capacity mode” back to “On-demand”, then
amplify push
worked.I think I may have realized the issue. Once I add a
@connection
directive, it seems that it’s not possible to remove it and thenamplify push
again. This seems to be because adding a@connection
adds a GSI, which seems impossible to remove after adding. Is there a workaround for this? So far I’ve just had toamplify delete
and start over when making changes to@connection
directives.