amplify-cli: Template error: instance of Fn::GetAtt references undefined resource authcognito... when creating GraphQL API
Describe the bug
v 0.1.24 Creating or updating GraphQL API using Amazon Cognito User Pool, and then attempting to update resources in the cloud, results in this error being thrown: Template error: instance of Fn::GetAtt references undefined resource authcognito94275c60
Attempting the same with API key works perfectly. The problem only arises when I attempt with the User Pool.
To Reproduce Steps to reproduce the behavior:
- Create GraphQL API (
amplify add api
> GraphQL ) - Choose authorization type
Amazon Cognito User Pool
- Complete API creation
- Update cloud resources with
amplify push
Expected behavior Cloud resources should be updated successfully. Currently, it fails.
Desktop (please complete the following information):
- OS: Windows 10
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 40 (15 by maintainers)
So the issue here is that your GraphQL API is referencing the older Cognito User Pool which you’ve removed. Can you go through the
amplify update api
flow and update the user pool and see if the issue still exists?SUMMARY for those might run to this issue I got the same error after running:
amplify remove auth
then I added new authamplify add auth
then tried to pushamplify push
here I got the mentioned error. As explained above the api is still referencing to the OLD cognito-user-pool ID. so here what I did: 1-amplify update api
2- For ? Select from the options below chooseUpdate auth settings
3- For ? Choose the default authorization type for the API chooseAmazon Cognito User Pool
4- For ? Configure additional auth types? chooseNo
You will notice that the OLD cognito-user-pool ID is updated with the new one in your backEnd folder. Now you are ready to push byamplify push
Problem solvedI had the same problem but running
amplify update api
followed byamplify push
seemed to get the project back on track just fine. I agree it would be great if the API updated without user intervention but the above does work where you delete an auth resource and create a new one when using a graphql api.Exactly. If you had done an
amplify auth remove
theamplify api
has still an reference to the old auth one. In my opinion this is a bug@kaustavghosh06 sure will use just amplify push. A message explaining what to do next would be useful when amplify api push detect a not valid auth stack. This thread shows that I’m not the only one confused by it.