amplify-cli: Amplify Pull Request creates: Failed to pull the backend.

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

18.18.0

Amplify CLI Version

12.7.1

What operating system are you using?

Windows

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

I have been going along nice and wonderfully using Amplify. This weekend, I decided to do something awesome and push a Mutation for a function that was generated outside of Amplify. It was a brilliant idea in my head and how much damage could it do if it did not work?

It did not work. It did a lot of damage.

I finally got my changes backed out from CloudFormation and Cloudformation was in a UPDATE SUCCESSFULL state.

  1. I created a Appsync function to mimc the function that Cloudformation was saying was missing.
  2. I deleted an created a new API key (because the current API key had expired during this endeavor AND it was causing more problems…fortunately, I was able to delete the API key and create a much bigger problem).

Describe the bug

I have been going along nice and wonderfully using Amplify. This weekend, I decided to do something awesome and push a Mutation for a function that was generated outside of Amplify. It was a brilliant idea in my head and how much damage could it do if it did not work?

It did not work. It did a lot of damage.

I finally got my changes backed out from CloudFormation and Cloudformation was in a UPDATE SUCCESSFULL state.

Now…when I commit changes to github to kick of a new build, the build fails with: 🛑 Failed to pull the backend. !!! Build Failed !!! Non-Zero Exit Code detected.

…You can imagine my surprise. The coder was so out of his mind about the seriousness of this error that he put THREE exclamation marks BEFORE the message.

When I try to pull the backend through Amplify Pull on my laptop, I get:

🛑 Failed to pull the backend.

I think the coder had calmed down that they did not put any exclamation marks.

I know its Friday so everyone is fried and ready for the weekend. Unfortunately, I have lost a week on this issue and am trying to get caught up this weekend.

Any and all help is greatly appreciated. 😃)))

Expected behavior

I expected my Amplify pull to pull down the environment. And I expected the build to work in Amplify.

Reproduction steps

Commit changes to Github through Visual Code. Watch build fail on Amplify Console. Download build logs from Amplify console. Try to pull enviromnent into a new environment on laptop

Project Identifier

Project Identifier: af45a07d874c083e1a72f541024c8c0c

Log output

2023-11-03T15:51:55.161Z|info : amplify push api  
2023-11-03T15:51:55.304Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-11-03T15:52:09.037Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["*******"])
2023-11-03T15:52:09.038Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"*******"}])
2023-11-03T15:52:09.038Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["*******"])
2023-11-03T15:57:28.038Z|info : amplify pull core  {"appId":"[***]sqn607","envName":"[***]od","yes":false}
2023-11-03T15:57:28.080Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-11-03T16:00:11.105Z|info : amplify-provider-awscloudformation.amplify-service-permission-check.checkAmplifyServiceIAMPermission.amplifyClient.listApps([])
2023-11-03T16:00:11.492Z|info : amplify-provider-awscloudformation.attach-backend.getAmplifyApp.amplifyClient.getApp([{"appId":"[***]sqn607"}])
2023-11-03T16:00:11.896Z|info : amplify-provider-awscloudformation.attach-backend.getBackendEnv.amplifyClient.getBackendEnvironment([{"appId":"[***]sqn607","environmentName":"[***]od"}])
2023-11-03T16:00:12.275Z|info : amplify-provider-awscloudformation.attach-backend.downloadBackend.s3.getObject([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]-[***]od-[***]339-[***]ment"}])
2023-11-03T16:00:20.524Z|error : Failed to pull the backend.
PullBackendFault: Failed to pull the backend.
2023-11-03T16:40:45.214Z|info : amplify version core  
2023-11-03T16:44:54.954Z|info : amplify diagnose core  {"send-report":true,"yes":false}
2023-11-03T16:44:55.005Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}


Additional information

I AmplifyPull AmplifyBuildFails

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Thanks Ykethan for all your help!!! It was very appreciated!

Hey @phreitom, thank you for hopping on the call, it was amazing chatting with you. To summarize the issue:

we noticed that the #current-cloud-backend.zip had a nested current-cloud-backend folder. On re-zipping and uploading the zip; we were able to successfully run a amplify pull. when running a push with a small change to the API we encountered an expired API key, on utilizing the mitigation steps in https://github.com/aws-amplify/amplify-category-api/issues/636#issuecomment-1288164584 we were able to regenerate the API key. Additionally, we encountered StreamsArn missing error, on enabling the streams with New and Old Images as section we were able to mitigate the error and successfully push.

Closing the issue, please feel free in reaching out to us again.

Hey @phreitom, Thank you for the information. Are you running the pull in a new empty directory?

Could it be that #current-cloud_backend.zip has an extra folder in at the top CurrentCloudBackEnd. So amplify-meta.json is at a level deeper than expected?

looking at the screenshot it appears the zip has a nested folder we may have to rezip the current-cloud-backend and then pull. Would you be open for a quick call, i am available on discord at handle ykethan

@phreitom just a quick check, noticed amplify#current-cloud-backend doesn’t not have \ in the path. Was this mistakenly modified when removing the AppName? additionally, in Amplify hosting could you add a environment variable in the App settings AMPLIFY_ENABLE_DEBUG_OUTPUT as true and re-build the app. Could you provide us the output from the backend build?