I have created a Cognito resource using amplify add auth
, but am now attempting to remove it. I have run amplify auth remove
to do to, but when trying to push the changes I get the above "template error".
Hi @Jayphen ,
Could you please provide us with more information so we can investigate the issue faster?
How did you configure auth category before the amplify auth remove
is executed?
Have you manually edited the cloudformation template locally?
Have you manually modified the Cognito User Pool or Identity Pool on the Cognito console? if so, how?
Hey! I will try to replicate the bug if I can so that I can give better information.
Apart from adding the auth using amplify add auth
, I also edited my schema locally to add @auth to one of the models, and pushed that using amplify push
.
I edited the userpool in the Cognito console by changing some settings under Policies and Attributes, and manually adding some users.
I made no local edits to any of the local cloudformation files.
I am only working off memory here, so I may have made some other changes that I do not recall. I may have edited the auth using amplify auth update
and changed the default password policy, and then pushed those changes.
For some background information, and in case it helps somehow — I have no prior experience with AWS, so some terminology etc is foreign to me. I saw some activity on social media about the CLI tool and read the blog at https://aws.amazon.com/blogs/mobile/announcing-the-aws-amplify-cli-toolchain and built out a little todo app in React with it.
The reason I was adding/removing auth was because I added it and was then trying to figure out how to remove the required Phone Number field in the signup form created when using the withAuthentor
HOC. I still don't know how, but I assume I need to make my own signup component :)
edit: Also, I ended up successfully removing auth by first removing the AuthCognitoUserPoolId
config object from parameters.json
and then running amplify push
I think this was your flow, amplify api add -> added auth in the flow (which created a auth (cognito) resource) -> amplify push -> amplify auth remove -> amplify auth add (with updated configs) ?
After this, ideally you would've had to do an 'amplify api update' and update the auth preferences to use the newly added auth resource otherwise you might encounter the above-mentioned error.
Are you still blocked on this issue?
I did not add auth in the initial flow – I added it some time after the initial flow and then tried to remove it, at which point I got the error above.
I'm no longer blocked (amplify push
succeeded once I removed AuthCognitoUserPoolId
locally)
@Jayphen Please check out the latest version of the CLI and let me know if the issue still persists. Closing the issue for now.
I've got the same error. I wanted to remove the existing cognito userpool from my project.
After removing the AuthCognitoUserPoolId
field from parameters.json (as @Jayphen mentioned) i was able to do amplify push
.
My CLI Version is 0.1.27
I had the same error, but in my case I had to remove all AuthCognitoUserPoolId
objects from amplify/**
folder
@kaustavghosh06 this bug is still happening, I have the same situation described by @Jayphen and I'm using amplify-cli v4.18.1
@LucasAndrad could you please be more specific about the error? This seems like an issue from almost 2 years back. Did you try the steps mentioned out https://github.com/aws-amplify/amplify-cli/issues/172#issuecomment-422185270 and https://github.com/aws-amplify/amplify-cli/issues/172#issuecomment-624687219 to resolve your issue?
Ran into this also. Thank you @Jayphen and @pechisworks for the work-around!
This is still an issue on amplify version 4.29.8, over 2 years later.
The workaround mentioned above works.
Note however there are multiple parameters.json
files. For me, I had to remove it from backend/api/XXX/parameters.json
which controls the API Gateway (GraphQL) configuration, not Cognito's configuration which lives in backend/auth/XXX
. This is probably why the devs can't reproduce it.
Most helpful comment
I've got the same error. I wanted to remove the existing cognito userpool from my project.
After removing the
AuthCognitoUserPoolId
field from parameters.json (as @Jayphen mentioned) i was able to doamplify push
.My CLI Version is 0.1.27