`amplify env checkout` Hangs
See original GitHub issueBefore 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]: [0mAmplify AppID found: XXXX. Amplify App name is: XXX[0m
2022-08-30T18:46:00.313Z [INFO]: [0mBackend environment dev found in Amplify Console app: XXX[0m
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]: [0mAmplify AppID found: XXX. Amplify App name is: XXX[0m
2022-08-30T19:47:31.567Z [INFO]: [0mBackend environment dev found in Amplify Console app: XXX[0m
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
amplify env checkout dev
ORamplify pull --appId XXX --envName dev
OR- 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:
- Created a year ago
- Reactions:1
- Comments:20 (7 by maintainers)
@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:
If we click on
dev
orView details
, it opens the details page:A few seconds (3-10) after the page has loaded, the contents of the page entirely disappear and it’s broken:
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.
@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.