aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 819 forks source link

Cannot find template and update failed due to cognito even when it's not updated #2554

Closed damianrr closed 4 years ago

damianrr commented 4 years ago

Hello, Recently I tried to push my changes to amplify, I've touched the code of only 2 functions, no cognito, no appsync. Yet I'm having 2 errors that I don't understand and don't know how to fix: The first seems like a warning (yellow letters) as soon as I amplify push it saids: Could not read cloudformation template at path: /.../portal/amplify/backend/api/portal/build/cloudformation-template.json

The second forces a rollback of the deploy and it saids: UPDATE_FAILED authcognitoPortal AWS::CloudFormation::Stack Thu Oct 10 2019 12:56:20 GMT-0400 (Eastern Daylight Time) Parameters: [allowUnauthenticatedIdentities, identityPoolName, thirdPartyAuth] do not exist in the template

this are images with screenshots of the errors: https://imgur.com/a/24YkUeE

This is a production app and I'd really appreciate any help here. Thanks.

PD: I emailed my app arn to [REDACTED] just in case you need it.

haverchuck commented 4 years ago

@damianrr Could you share the Parameters block of your auth stack's cloudformation template? You can send it to amplify-cli@amazon.com. Thanks.

damianrr commented 4 years ago

Hello @haverchuck,

I sent my auth's cloudformation template file along with it's parameter.json; just to be sure here, you're asking for the file located at: my-project/amplify/backend/auth/myCognitoResource/myCognitoResource-cloudformation-template.yml ... is that correct?

haverchuck commented 4 years ago

@damianrr That's correct.

damianrr commented 4 years ago

perfect. Let me know if you see something that could be causing this or if you need anything else from me. Thanks!

haverchuck commented 4 years ago

@damianrr Which version of the Amplify CLI are you using?

damianrr commented 4 years ago

3.0.0

haverchuck commented 4 years ago

@damianrr I've tried reproducing this - no luck. Have you been using the same version of the CLI for the lifetime of this project? For the updates to functions, did you run an 'amplify function update' or did you just manually edit the src code? Thanks.

damianrr commented 4 years ago

@haverchuck, I've updated amplify a couple of times since I started working in this project (early 2019), I've done amplify update function before to give some permissions and get some env vars accessibles but the latest changes are strictly code. Also, the problem seems to be with cognito isn't it? Why would I be getting the not found file at /.../portal/amplify/backend/api/portal/build/cloudformation-template.json, maybe at some point I screwed up and delete it (it's truly not there BTW)? How could I recover from that (I mean, that file if it ever existed wasn't version controlled)?

Thanks.

yuth commented 4 years ago

Could you try running amplify api gql-compile before running an amplify push. This issue was fixed in https://github.com/aws-amplify/amplify-cli/pull/2559 and was released in Amplify CLI 3.14.0

damianrr commented 4 years ago

Hey @yuth I tried that and still got the same error: UPDATE_FAILED authcognitoPortal AWS::CloudFormation::Stack Tue Oct 15 2019 09:10:33 GMT-0400 (Eastern Daylight Time) Parameters: [allowUnauthenticatedIdentities, identityPoolName, thirdPartyAuth] do not exist in the template

yet my amplify is 3.0.0 (amplify --version => 3.0.0) Should I upgrade it?

Also, my problem doesn't seem like it has something to do with GraphQL but with cognito.

damianrr commented 4 years ago

Also, I'm using cognito post-confirmation trigger, I tried to remove it with amplify auth update which updates the auth and remove the customMessage function and I when I push I get this error:

UPDATE_FAILED  UpdateRolesWithIDPFunctionOutputs Custom::LambdaCallout Tue Oct 15 2019 09:34:57 GMT-0400 (Eastern Daylight Time) Output 'IdentityPoolId' not found in stack 'arn:aws:cloudformation:us-east-1:155161765563:stack/portal-20190328173653-authcognitoPorta
l-SNDSKN551BGF/772e6880-51a3-11e9-976f-0a6bdb6a0e76'
damianrr commented 4 years ago

Guys, I managed to fix this issue by doing this: https://github.com/aws-amplify/amplify-cli/issues/2096#issuecomment-523746110 Now, question: What implications could it have to my application that I leave my authorization/authentication preferences with the option: User Sign-Up, Sign-In, connected with AWS IAM controls (Enables per-user Storage features for images or other content, Analytics, and more) instead of using the one I've been using so far (and that best describes my application). User Sign-Up & Sign-In only (Best used with a cloud API only) would it stop using my user pool for authentication? What changes here from my perspective?

Thanks.

mrducky4 commented 4 years ago

I have a similar issue with amplify push using amplify CLI 3.9.0, with initial error: Could not read cloudformation template at path: xxxxx\fa-console\amplify\backend\api\facilitiesconsole\build\cloudformation-template.json this file does not exist, and I don't know when it should be created if it is supposed to exist.

But then the next error is: UPDATE_FAILED apifacilitiesconsole AWS::CloudFormation::Stack Wed Oct 16 2019 21:51:41 GMT-0400 (Eastern Daylight Time) Parameters: [unauthRoleName, authRoleName] do not exist in the template

I tried the workaround damianrr mentioned in #2096, but it didn't work, and I think I had that setting already anyway because I know I already had identity pools as well as user pools in cognito.

This also seems related to #2519, at least for me.

update: Same with amplify cli version 3.15.0, same failure.

kaustavghosh06 commented 4 years ago

@damianrr No, the update would retain your user pool and it will be used for authentication.

github-actions[bot] commented 3 years ago

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.