Amplify-console: Backend build warning: "Could not read cloudformation template at path"

Created on 9 Jul 2019  ·  20Comments  ·  Source: aws-amplify/amplify-console

Which Category is your question related to?

CLI and Console at the same time.

What AWS Services are you utilizing?

I'm running multienv, got the usual dev and prod. Project is live. To push API or function changes faster I like to use the CLI. To release in full and to deploy to production, I like to merge to my master branch and have it trigger the automatic production build. For testing major changes before deploying to production, I like to push to my develop branch and have it build also using the Console.

Here's what I'm confused about:

  • The Console seems to not really care much about the overall state and just pushes according to the CloudFormation templates pulled from the branch, but could it be missing some files that are ignored in my Git?
  • The CLI seems to get out of sync and not know what's the current status when Console is also deploying
  • Doing amplify env pull does not get the CLI up to speed if I my latest deployment is with the Console. Only when I do amplify push, the CLI will say "No Change" for all functions and API's.

So my question is. How do I bring both in sync and do I risk any bad overwrites doing amplify push if I don't do amplify env pull after having deployed with Console?

I thought amplify env pull would also pull the cloud down? amplify pull env --restore seems a bit dangerous and I'm worried it could overwrite locally changed files?

backend bug

Most helpful comment

@timothy-baker @nino-moreton @houmark: We root caused the issue to the amplify/backend/api/myapi/build/ folder not being checked into source control. As a workaround, please run amplify gql-compile and amplify push --yes from your local machine, and check the build folder into source control (EXCEPT for the amplify/backend/api/myapi/build/parameters.jsonfile). With the next CLI release we will fix this to ensure customers do not face a similar issue.

All 20 comments

This has lead to us frequently doing amplify env pull --restore whenever a push to the amplify api fails or when we do amplify status and it tells has something has changed in our resources when really there weren't any (just doing amplify env checkout [env name] simply doesn't work for this case.

Yeah, I wanted to test that out more also, and close monitor which files it overwrites in my local working copy, but I seem to have constant changes that I don't want to lose, so I haven't had the opportunity to try this out that.

I think the CLI should be able to detect a more recent Console release when doing amplify status or at least amplify env pull and then do an automatic --restore or a more gentle one that simply gets the affected services set to "No change".

I would love clarification on this and know if something is in the works towards better sync or compatibility between the CLI and Console from the core Amplify developers.

@houmark Yes, we're currently working to make the console + CLI synchronization smoother and make things which you've mentioned above simpler.

@houmark

  1. Do you share the same backend infrastructure from the CLI as well as the Console?
  2. If yes, amplify env pull should pull in the current cloud configurations into your amplify/#current-cloud-backend directory configurations. The amplify evn pull --restore command would overwrite your amplify/backend directory with whatever configurations you have in the cloud (stored in `amplify/#current-cloud-backend`` when you deploy it via the Amplify console.

Thanks for your feedback @kaustavghosh06!

Not sure what you mean with 1. But I would think my answer is yes, I have nothing custom or special running, I actually only just found out about the Console existing once I was looking to connect a real domain with my web app when I was getting close to the first release. All through development I only used the CLI and as I mentioned, I still do, as it's faster in development to switch to a terminal and do amplify push -y when I have done changes to for example a function. This way I am not deploying the frontend either.

For 2. I am not seeing that, but can you point me to what exactly I should expect when doing --restore. This only overwrites amplify/backend and below? What if #current-cloud-backend for some reason is out of sync? I had a really weird situation trying to add Pinpoint, where it would recreate pinpoint on every single deploy in Console and at some point, I could not deploy as I had reached a policy limit of 10. I found the policies and deleted them manually and deleted pinpoint, but never really found out what happened. I still have one pinpoint hanging around in my dev environment, but production is clean and if I delete that one then I will recreate. But I do not see pinpoint in amplify status. Something got corrupted and debugging and trying to clean up is really hard. If this happened due to some kind of confusion between Console and the CLI or it was a CLI bug I am not sure, but I'd love to get things cleaned up.

In any case, my current take away is that if I have a fully clean local working copy of my Git with no local changes, and I still see updates in the CLI on amplify status it should be safe to do amplify env pull --restore?

Something like a more in-depth check in the cloud when doing amplify status or amplify checkout env with an automatic pull of cloud files and overwrite locally, if the local folder/Git is clean and with a CLI warning/question to update/overwrite local files with cloud files, if Git is not clean, would be nice.

@hourmark I'm the PM on the Console team working on a better CLI+Console experience.
Some questions:

  1. When you connected your app in the console did you pick an existing environment or did you create a new one?
  2. We are working on providing more insight in the console wrt the backend. A developer should be able to:
  3. View resources and environments created in the CLI from the Console.
  4. Point the CLI created backend to a specific frontend in the Console.
  5. Delete resources and environments from the Console and have a way to reflect the changes in the CLI
  6. Update resources in the Console and have a way to pull those changes to the CLI.

What else would you like to see?

@swaminator

  1. I picked an existing one (well, two, I connected both dev and prod which existed already)

Thanks for the update on your vision on the Console. It has a lot to wish for still, but it's a good start.

Besides perfect sync between CLI and Console, I would like to see:

  1. Ability to do sub sub domains for a domain, even while keeping the root domain out of play. Our setup is site.com with our main site. members.site.com which is the Amplify React SPA. And for testing/staging we would like to have for example testing.member.site.com

  2. Some way to not deploy frontend of backend, so we can quicker push out changes in the Console without having to wait for either of the two slower steps.

  3. Outbound webhooks to trigger after a deployment has fully finished and is verified. Or at least a webhook no matter what happens with the result. This could be useful to somehow trigger a subscription for the user to update the site "due to a new version available".

I'm still new around here, so I may come back to add more comments if anything else comes to mind, but for now, thanks for listening and being interested in your users feedback, something great is in the making with the Amplify platform, can't wait to see where all this is in one year from now.

@houmark

  1. Checkout https://docs.aws.amazon.com/amplify/latest/userguide/custom-domains.html#custom-domain-subdomains
  2. Can you explain a bit more?
  3. You can add Email notifications in the Console. This actually creates an SNS topic which you can use however you want (setup Slack notification as an example)

Thanks for the feedback.

@swaminator Thanks for your feedback!

  1. Hmm, I thought I had read that but couldn't find it again. I guess what confused me was that it's kinda warning when you have the main domain abc.com and type in sub.abc.com as the root domain, so it's not very intuitive. I guess a text like "want to create sub sub domains? Check out the documentation" with a link to that page would be helpful. Or maybe I'm the only one that couldn't connect the dots here.

  2. When I push one commit to the develop branch, it will run both backend and frontend in full. Maybe it could auto detect that the backend has no changes internally using "amplify status" and just jump that step for a faster frontend deployment (think bug in production in the frontend code, push a fix, but have to wait for the backend to deploy which can be some heavy 5+ minutes). Manual triggers for deciding which parts would be nice also. It could for example be based on Git commit messages and the content thereof. For example, if you put [deploy:frontend] it would only deploy the frontend (this idea is based on another Git hosted platform I am using).

  3. Nice to know. That may work for our need, I'll check it out.

In the meantime, today I had a clean working copy in my dev branch for the first time in a good period and I had deployed with the Console, so doing amplify status resulted in many changed resources (that was already deployed through the Console). I did a amplify env pull --restore which resulted in some new CloudFormation files locally. Not a biggie and since the Console cannot (and should not!) write to the Git branch, these files need to be committed (which then will result in a new deployment in Console, that I believe it could auto ignore with some more pre-flight checks on the changes committed).

The main take away from this, in relation to confusion for me as a developer, was this error on my next CLI push right after showing the current status:

Could not read cloudformation template at path: 

`/Site/project/amplify/backend/api/myapi/build/cloudformation-template.json`

Does not seem to affect anything and I have seen this once before, but it eventually went away (not sure what made it go away though). Suggestions on that one?

I'm running into this issue now. CLI v3.2.0. Here are my build logs:

                                 # Starting phase: build
                                 # Executing command: amplifyPush --simple
2019-09-24T19:44:08.047Z [INFO]: # Getting Amplify CLI Cloud-Formation stack info from environment cache
2019-09-24T19:44:08.054Z [INFO]: # Start initializing Amplify environment: dev
2019-09-24T19:44:08.056Z [INFO]: STACKINFO={
                                 "awscloudformation": {
                                 "AuthRoleName": "MYAPP-admin-portal-dev-20190905221435-authRole",
                                 "UnauthRoleArn": "arn:aws:iam::012345678910:role/MYAPP-admin-portal-dev-20190905221435-unauthRole",
                                 "AuthRoleArn": "arn:aws:iam::012345678910:role/MYAPP-admin-portal-dev-20190905221435-authRole",
                                 "Region": "us-west-2",
                                 "DeploymentBucketName": "MYAPP-admin-portal-dev-20190905221435-deployment",
                                 "UnauthRoleName": "MYAPP-admin-portal-dev-20190905221435-unauthRole",
                                 "StackName": "MYAPP-admin-portal-dev-20190905221435",
                                 "StackId": "arn:aws:cloudformation:us-west-2:012345678910:stack/MYAPP-admin-portal-dev-20190905221435/755955d0-d054-11e9-b96f-0ae846f1e916"
                                 },
                                 "categories": {
                                 "function": {
                                 "MYAPPAuthPreTokenGeneration": {},
                                 "MYAPPAuthAdminFunctions": {}
                                 },
                                 "auth": {
                                 "MYAPPAuth": {}
                                 }
                                 }
                                 }
                                 # Importing Amplify environment: dev (amplify env import)
2019-09-24T19:44:15.694Z [INFO]: Successfully added environment from your project
2019-09-24T19:44:15.748Z [INFO]: # Initializing existing Amplify environment: dev (amplify init)
2019-09-24T19:44:19.220Z [INFO]: Note: It is recommended to run this command from the root of your app directory
2019-09-24T19:44:20.260Z [WARNING]: - Initializing your environment: dev
2019-09-24T19:44:20.577Z [WARNING]: ✔ Initialized provider successfully.
2019-09-24T19:44:20.746Z [INFO]: Could not read cloudformation template at path: /codebuild/output/src999090617/src/MYAPP-admin-portal/amplify/backend/api/MYAPPApi/build/cloudformation-template.json
2019-09-24T19:44:20.803Z [WARNING]: - Updating resources in the cloud. This may take a few minutes...
2019-09-24T19:44:26.313Z [INFO]: 
2019-09-24T19:44:26.317Z [INFO]: UPDATE_IN_PROGRESS MYAPP-admin-portal-dev-20190905221435 AWS::CloudFormation::Stack Tue Sep 24 2019 19:44:21 GMT+0000 (Coordinated Universal Time) User Initiated
                                 UPDATE_IN_PROGRESS storagecontent                        AWS::CloudFormation::Stack Tue Sep 24 2019 19:44:23 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_IN_PROGRESS functionMYAPPAuthPreTokenGeneration   AWS::CloudFormation::Stack Tue Sep 24 2019 19:44:24 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_COMPLETE    storagecontent                        AWS::CloudFormation::Stack Tue Sep 24 2019 19:44:24 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_COMPLETE    functionMYAPPAuthPreTokenGeneration   AWS::CloudFormation::Stack Tue Sep 24 2019 19:44:24 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:44:31.300Z [INFO]: 
2019-09-24T19:44:31.301Z [INFO]: UPDATE_IN_PROGRESS authMYAPPAuth AWS::CloudFormation::Stack Tue Sep 24 2019 19:44:26 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:44:31.445Z [INFO]: 
2019-09-24T19:44:31.447Z [INFO]: UPDATE_IN_PROGRESS MYAPP-admin-portal-dev-20190905221435-authMYAPPAuth-1IJB7V8A2FDIU AWS::CloudFormation::Stack Tue Sep 24 2019 19:44:27 GMT+0000 (Coordinated Universal Time) User Initiated
2019-09-24T19:44:36.395Z [INFO]: 
2019-09-24T19:44:36.396Z [INFO]: UPDATE_IN_PROGRESS UserPool AWS::Cognito::UserPool Tue Sep 24 2019 19:44:33 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_COMPLETE    UserPool AWS::Cognito::UserPool Tue Sep 24 2019 19:44:35 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:44:51.416Z [INFO]: 
2019-09-24T19:44:51.418Z [INFO]: UPDATE_COMPLETE_CLEANUP_IN_PROGRESS MYAPP-admin-portal-dev-20190905221435-authMYAPPAuth-1IJB7V8A2FDIU AWS::CloudFormation::Stack Tue Sep 24 2019 19:44:50 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:45:06.319Z [INFO]: 
2019-09-24T19:45:06.320Z [INFO]: UPDATE_COMPLETE             authMYAPPAuth                         AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:01 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_IN_PROGRESS          apiMYAPPApi                           AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:04 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_FAILED               apiMYAPPApi                           AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:04 GMT+0000 (Coordinated Universal Time) Parameters: [unauthRoleName, authRoleName] do not exist in the template
                                 UPDATE_ROLLBACK_IN_PROGRESS MYAPP-admin-portal-dev-20190905221435 AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:05 GMT+0000 (Coordinated Universal Time) The following resource(s) failed to update: [apiMYAPPApi].
2019-09-24T19:45:16.394Z [INFO]: 
2019-09-24T19:45:16.396Z [INFO]: UPDATE_IN_PROGRESS functionMYAPPAuthPreTokenGeneration AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:11 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_IN_PROGRESS storagecontent                      AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:11 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_COMPLETE    functionMYAPPAuthPreTokenGeneration AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:11 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_COMPLETE    storagecontent                      AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:11 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_IN_PROGRESS authMYAPPAuth                       AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:12 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:45:16.551Z [INFO]: 
2019-09-24T19:45:16.553Z [INFO]: UPDATE_ROLLBACK_IN_PROGRESS MYAPP-admin-portal-dev-20190905221435-authMYAPPAuth-1IJB7V8A2FDIU AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:12 GMT+0000 (Coordinated Universal Time) User Initiated
                                 UPDATE_IN_PROGRESS          UserPool                                                          AWS::Cognito::UserPool     Tue Sep 24 2019 19:45:14 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_COMPLETE             UserPool                                                          AWS::Cognito::UserPool     Tue Sep 24 2019 19:45:16 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:45:21.427Z [INFO]: 
2019-09-24T19:45:21.429Z [INFO]: UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS MYAPP-admin-portal-dev-20190905221435-authMYAPPAuth-1IJB7V8A2FDIU AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:20 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:45:26.322Z [INFO]: 
2019-09-24T19:45:26.324Z [INFO]: UPDATE_COMPLETE                              authMYAPPAuth                         AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:23 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_COMPLETE                              apiMYAPPApi                           AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:24 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS MYAPP-admin-portal-dev-20190905221435 AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:25 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_IN_PROGRESS                           apiMYAPPApi                           AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:26 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_IN_PROGRESS                           storagecontent                        AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:26 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:45:26.534Z [INFO]: 
2019-09-24T19:45:26.535Z [INFO]: UPDATE_COMPLETE apiMYAPPApi    AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:26 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_COMPLETE storagecontent AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:26 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:45:31.348Z [INFO]: 
2019-09-24T19:45:31.349Z [INFO]: UPDATE_IN_PROGRESS authMYAPPAuth AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:26 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:45:31.439Z [INFO]: 
2019-09-24T19:45:31.439Z [INFO]: UPDATE_ROLLBACK_COMPLETE MYAPP-admin-portal-dev-20190905221435-authMYAPPAuth-1IJB7V8A2FDIU AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:27 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:45:41.365Z [INFO]: 
2019-09-24T19:45:41.367Z [INFO]: UPDATE_COMPLETE          authMYAPPAuth                         AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:37 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_IN_PROGRESS       functionMYAPPAuthPreTokenGeneration   AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:37 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_COMPLETE          functionMYAPPAuthPreTokenGeneration   AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:38 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_ROLLBACK_COMPLETE MYAPP-admin-portal-dev-20190905221435 AWS::CloudFormation::Stack Tue Sep 24 2019 19:45:38 GMT+0000 (Coordinated Universal Time)
2019-09-24T19:45:51.408Z [WARNING]: Error updating cloudformation stack
2019-09-24T19:45:56.413Z [INFO]: Following resources failed
2019-09-24T19:45:56.416Z [INFO]: init failed
                                 { ResourceNotReady: Resource is not in the state stackUpdateComplete
                                 at constructor.setError (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/resource_waiter.js:182:47)
                                 at Request.CHECK_ACCEPTORS (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/resource_waiter.js:44:12)
                                 at Request.callListeners (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
                                 at Request.emit (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
                                 at Request.emit (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:683:14)
                                 at Request.transition (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)
                                 at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)
                                 at /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10
                                 at Request.<anonymous> (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)
                                 at Request.<anonymous> (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:685:12)
                                 at Request.callListeners (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
                                 at Request.emit (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
                                 at Request.emit (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:683:14)
                                 at Request.transition (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)
                                 at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)
                                 at /root/.nvm/versions/node/v10.16.0/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10
                                 message: 'Resource is not in the state stackUpdateComplete',
                                 code: 'ResourceNotReady',
                                 retryable: false,
                                 time: 2019-09-24T19:45:51.408Z,
                                 statusCode: 200,
                                 retryDelay: 30000 }
2019-09-24T19:45:56.417Z [WARNING]: ✖ An error occurred when pushing the resources to the cloud
                                    ✖ There was an error initializing your environment.
2019-09-24T19:45:56.460Z [ERROR]: !!! Build failed
2019-09-24T19:45:56.588Z [ERROR]: !!! Non-Zero Exit Code detected
2019-09-24T19:45:56.588Z [INFO]: # Starting environment caching...
2019-09-24T19:45:56.588Z [INFO]: # Uploading environment cache artifact...
2019-09-24T19:45:56.700Z [INFO]: # Environment caching completed
Terminating logging...

@timothy-baker @nino-moreton @houmark: We root caused the issue to the amplify/backend/api/myapi/build/ folder not being checked into source control. As a workaround, please run amplify gql-compile and amplify push --yes from your local machine, and check the build folder into source control (EXCEPT for the amplify/backend/api/myapi/build/parameters.jsonfile). With the next CLI release we will fix this to ensure customers do not face a similar issue.

@swaminator Can you please link to the CLI issue or PR to track this issue?

Are you stating that including the build folder in git should be done going forward, or that this is a temporary workaround.

Since I need auto-deploy to work, I found a temporary fix that works for my existing environments (but not for feature branches where new environments are created by the console directly). Hope it can help anyone.

https://gist.github.com/thedgbrt/11158b45df9bc79dd0e8869b5412b19d

Simply add it to your repo (I added it to /scripts/) and change the build step of amplify.yml for

build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - sh scripts/amplifyPushAlt.sh

@swaminator what's the progress status? I still can't build existing branches (so basically, all main branches) without using the hacky workaround I posted above. If I want to test on a separate branch / environment, I have to switch the build command to the normal amplifyPush for the first build, and then switch to my hack again for the subsequent ones. This bug really makes the whole process much more complicated than it needs to be...

@thedgbrt we're going to merge this PR toady: https://github.com/aws-amplify/amplify-cli/pull/2003. Once merged we will release the update tomorrow (Tuesday). Will notify you here once merged.

@thedgbrt @Cas-Laputa the new version of the CLI is out (3.12.0). Can you please verify it works for you. Thanks for your patience.

@swaminator I just tried it, it has the same issue: Could not read cloudformation template at path... and then the build step fails.

I double checked that I was using amplify 3.12.0 override in the console.

I am not sure I understand the fix properly though. Does the cli now generates a new file on build that I should add to my repo? I did a new build locally (with 3.12.0) but couldn't see anything relevant added to my git state.

Here are my config files if that helps:

amplify.yml:

version: 0.1
backend:
  phases:
    preBuild:
      commands:
        - export NPM_TOKEN=$NPM_TOKEN
        - export GATSBY_RECAPTCHA_KEY=$GATSBY_RECAPTCHA_KEY
        - echo -e "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
        - echo -e "GATSBY_RECAPTCHA_KEY=${GATSBY_RECAPTCHA_KEY}" > ~/.env.production
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: public
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

.gitignore:

amplify/\#current-cloud-backend
amplify/.config/local-*
amplify/mock-data
amplify/backend/amplify-meta.json
amplify/backend/awscloudformation
build/
dist/
node_modules/
aws-exports.js
awsconfiguration.json

@thedgbrt thanks for your patience - we actually found the root cause was something else. We released 3.13.0. Please give that a shot.

@swaminator I tested a few scenarios and all seem to be working fine 👍🥳

Thanks! Closing this issue.

Was this page helpful?
0 / 5 - 0 ratings