question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`amplify env checkout` Hangs

See original GitHub issue

Before opening, please confirm:

  • I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • 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.

How did you install the Amplify CLI?

npm -g i @aws-amplify/cli

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

18.7.0

Amplify CLI Version

9.2.1

What operating system are you using?

macOS 12.5.1

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

No.

Amplify Categories

auth, storage, function, api, analytics, hosting, notifications

Amplify Commands

env

Describe the bug

We had previously (a few days ago) deployed Hosting to our dev environment. Everything was working great.

Today, we went to deploy Hosting to our production environment. Coincidentally (before we did anything), we happened to notice that the Amplify Hosting environment build had failed 3 minutes before. This was surprising since 7 minutes prior to that, the build worked (and nothing in the Amplify-deployed Next.js code had changed). Upon further inspection, here’s the difference in the Backend Build process:

Successful Build

                                 ## Checking for associated backend environment...
                                 ## Backend environment association found
2022-08-30T18:45:58.137Z [INFO]: ## Running amplify pull to generate aws-exports.js file for frontend
2022-08-30T18:46:00.214Z [INFO]: Amplify AppID found: XXXX. Amplify App name is: XXX
2022-08-30T18:46:00.313Z [INFO]: Backend environment dev found in Amplify Console app: XXX
2022-08-30T18:46:01.408Z [WARNING]: - Fetching updates to backend environment: dev from the cloud.
2022-08-30T18:46:02.663Z [INFO]: Overrides functionality is not implemented for this category
                                 Overrides functionality is not implemented for this category
2022-08-30T18:46:02.663Z [INFO]: Overrides functionality is not implemented for this category
2022-08-30T18:46:02.663Z [WARNING]: - Building resource auth/XXX
2022-08-30T18:46:02.879Z [WARNING]: - Building resource auth/userPoolGroups
2022-08-30T18:46:03.027Z [WARNING]: - Building resource api/XXX
2022-08-30T18:46:03.028Z [WARNING]: - Building resource storage/XXX
2022-08-30T18:46:03.028Z [INFO]: Overrides functionality is not implemented for this category
2022-08-30T18:46:03.029Z [INFO]: Overrides functionality is not implemented for this category
                                 Overrides functionality is not implemented for this category
2022-08-30T18:46:03.029Z [WARNING]: ✔ Successfully pulled backend environment dev from the cloud.
2022-08-30T18:46:03.039Z [WARNING]: - Retrieving channel information for APNS.
2022-08-30T18:46:03.117Z [WARNING]: ✔ Channel is not setup for APNS
2022-08-30T18:46:03.117Z [WARNING]: - Retrieving channel information for FCM.
2022-08-30T18:46:03.223Z [WARNING]: ✔ Channel is not setup for FCM
2022-08-30T18:46:03.223Z [WARNING]: - Retrieving channel information for Email.
2022-08-30T18:46:03.306Z [WARNING]: ✔ Channel is not setup for Email
2022-08-30T18:46:03.306Z [WARNING]: - Retrieving channel information for SMS.
2022-08-30T18:46:03.362Z [WARNING]: ✔ Channel is not setup for SMS
2022-08-30T18:46:03.657Z [INFO]: ✅
2022-08-30T18:46:04.314Z [WARNING]: - Uploading files...

Failed Build

This happened 7 minutes later, without any changes to Amplify:

                                 ## Checking for associated backend environment...
                                 ## Backend environment association found
2022-08-30T19:47:29.419Z [INFO]: ## Running amplify pull to generate aws-exports.js file for frontend
2022-08-30T19:47:31.488Z [INFO]: Amplify AppID found: XXX. Amplify App name is: XXX
2022-08-30T19:47:31.567Z [INFO]: Backend environment dev found in Amplify Console app: XXX

That’s the extent of the Backend Build log, so something obviously stopped working.

We then went back to the CLI on a local developer machine and tried to run an amplify env checkout dev. This process now hangs indefinitely (whereas before we could easily switch between environments in about 10-15 seconds):

$ amplify env checkout dev
⠇ Initializing your environment: dev

The same thing happens for an amplify pull:

$ amplify pull --appId XXX --envName dev
⠧ Fetching updates to backend environment: dev from the cloud.

Expected behavior

Amplify Backend Build should successfully check out the dev environment config and place the aws-exports.js as appropriate.

Further, amplify env checkout dev and amplify pull --appId XXX --envName dev should complete successfully in a reasonable amount of time (< 15s).

Reproduction steps

  1. amplify env checkout dev OR
  2. amplify pull --appId XXX --envName dev OR
  3. Trigger a dev build on Amplify console.

GraphQL schema(s)

N/A

Project Identifier

4e21dc38ea308f3725f90a3dbaf649db

Log output

N/A

Additional information

We are using a monorepo with the following structure:

/amplify /app (for a React Native app) /web (for the Amplify-hosted environment - Next.js)

The only other part to add here is that we did an amplify push with our production environment after this issue occurred. The only change for production was to add Hosting. That all worked correctly. The production hosting is working perfectly, but the dev environment remains broken, as described above.

It’s also worth noting that we are using Amplify CLI 9.1.0 for Amplify builds on the console in order to work around the “Creating a nested amplify project is not supported.” issue (which is currently broken on 9.2.1):

https://github.com/aws-amplify/amplify-cli/issues/10832#issuecomment-1225879252 https://github.com/aws-amplify/amplify-hosting/issues/2908

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
brianlenzcommented, Sep 1, 2022

@josefaidt, I don’t know if this is related, but we noticed today that when we view the details of a backend environment in the Amplify console, the page “crashes” and disappears. Starting here:

Screen Shot 2022-09-01 at 11 15 45 AM

If we click on dev or View details, it opens the details page:

Screen Shot 2022-09-01 at 11 16 18 AM

A few seconds (3-10) after the page has loaded, the contents of the page entirely disappear and it’s broken:

Screen Shot 2022-09-01 at 11 16 33 AM

This issue happens both for the dev environment and the production environment, which is interesting.

Just thought I would mention it since we noticed it, in case it is in any way related to the underlying issue.

1reaction
biller-aivycommented, Sep 23, 2022

@brianlenz had the same case. I added some frontends to my backend app through the amplify console “new app” function. The CLI V. 7.26 was the last working version, after that, amplify console build was always destroy my #current-cloud-backend zip file. The CLI from my local Mac was fine with v8. I just pulled the aws-export.js and don’t build the backend within the frontend deploy. I tested now v10 in the build settings, and it is working.

If you have a git repo, you can restore your #current-cloud-backend zip. Just zip your amplify/backend as #current-cloud-backend.zip, important is, that you mark the files itself, and not the backend folder. So that there is no parent folder inside the zip. After that, you can upload it to s3 and it should work again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`amplify env checkout` Hangs - GitHub
The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. - `amplify env checkout` Hangs ...
Read more >
Team workflows with Amplify backend environments
In the build settings screen, pick an existing backend environment to set up continuous deployment with the main branch. Choose prod from the...
Read more >
Amplify CLI hangs for hours when creating API models
Amplify CLI hangs for hours when creating API models · I believe this is a bug. I have seen 2-3 other reports. ·...
Read more >
Project-level configurations - Troubleshooting guide
Information to troubleshoot common Amplify CLI project errors. ... amplify pull --appId <YOUR_APP_ID> --envName dev; amplify env checkout beta; amplify push.
Read more >
Build and Deploy a Real-Time React App Using AWS Amplify ...
This tutorial is light on opinions, so that once you get a hang of the fundamentals, you can go on and tailor your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found