Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Amplify console fails to build: ✖ There was an error initializing your environment. #2318

Open
4 tasks done
dperconti opened this issue Oct 13, 2021 · 8 comments
Open
4 tasks done
Labels
backend-builds bug Something isn't working question Further information is requested

Comments

@dperconti
Copy link

Before opening, please confirm:

App Id

d39gw7seizrgo

Region

us-east-1

Amplify Console feature

Backend builds, Build settings, Manual deploys, Not applicable

Describe the bug

All backend builds are failing with the following error:

                                 # Starting phase: build
2021-10-13T02:42:57.329Z [INFO]: �[0mAmplify AppID found: d39gw7seizrgo. Amplify App name is: Altum�[0m
2021-10-13T02:42:57.405Z [INFO]: �[0mBackend environment dev found in Amplify Console app: Altum�[0m
2021-10-13T02:43:00.498Z [INFO]: App not deployed yet.
2021-10-13T02:43:01.052Z [INFO]: App not deployed yet.
2021-10-13T02:43:01.177Z [INFO]: �[32m�[39m
                                 �[32mGraphQL schema compiled successfully.�[39m
                                 �[32mEdit your schema at /codebuild/output/src549484123/src/altum-web/amplify/backend/api/altum/schema.graphql or place .graphql files in a directory at /codebuild/output/src549484123/src/altum-web/amplify/backend/api/altum/schema�[39m
2021-10-13T02:43:01.178Z [INFO]: App not deployed yet.
2021-10-13T02:43:01.282Z [INFO]: �[0mSuccessfully generated models. Generated models can be found in /codebuild/output/src549484123/src/altum-web/src�[0m
2021-10-13T02:43:01.283Z [WARNING]: - Fetching updates to backend environment: dev from the cloud.
2021-10-13T02:43:03.568Z [WARNING]: ✔ Successfully pulled backend environment dev from the cloud.
2021-10-13T02:43:03.589Z [INFO]: 
2021-10-13T02:43:07.456Z [INFO]: �[33mNote: It is recommended to run this command from the root of your app directory�[39m
2021-10-13T02:43:13.184Z [WARNING]: - Initializing your environment: dev
2021-10-13T02:43:15.625Z [WARNING]: ✔ Initialized provider successfully.
2021-10-13T02:43:15.713Z [WARNING]: ✖ An error occurred when pushing the resources to the cloud
2021-10-13T02:43:15.714Z [WARNING]: ✖ There was an error initializing your environment.
2021-10-13T02:43:15.736Z [ERROR]: !!! Build failed
2021-10-13T02:43:15.736Z [ERROR]: !!! Non-Zero Exit Code detected
2021-10-13T02:43:15.736Z [INFO]: # Starting environment caching...
2021-10-13T02:43:15.736Z [INFO]: # Uploading environment cache artifact...
2021-10-13T02:43:15.824Z [INFO]: # Environment caching completed
Terminating logging...

Expected behavior

Successful builds

Reproduction steps

This occurs only on a single backend environment (production). As far as I know, there is no different between any of the environments, but I'm also unsure how to troubleshoot this more.

Build Settings

version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Additional information

#1787
#1784
#1298

All of these issues suggest changing the version of the CLI. I've tried with the following versions from this page with no success:

6.2.1
6.1.1
5.6.0
5.5.0
5.3.0
5.0.1
4.52.0
@github-actions
Copy link

Hi 👋, thanks for opening! While we look into this...

If this issue is related to custom domains, be sure to check the custom domains troubleshooting guide to see if that helps. Also, there is a more general troubleshooting FAQ that may be helpful for other questions.

Lastly, please make sure you've specified the App ID and Region in the issue!

@ghost ghost added the question Further information is requested label Oct 13, 2021
@dperconti
Copy link
Author

Another note: I'm not sure if it's related, but here's some other troubleshooting that I've done.

  1. I cloned the backend environment and redeployed. This succeeded, but obviously it doesn't contain the data from the original backend.
  2. I've attempted to edit the models in the backend of the original and failing instance. The console is stating that the deployment has succeeded, but the changes do not persist. For example, I had a 'testing' table that I removed and deployed. When I refresh the page, that table is still there. This does not occur with the cloned backend.

@dperconti
Copy link
Author

dperconti commented Oct 13, 2021

I noticed a few errors back when this issue first started. This is from the deployment activity page:

Most recent failure:

FAILED | Command failed with exit code 7: /root/.amplify/bin/amplify push --yes - Fetching updates to backend environment: dev from the cloud. ✔ Successfully pulled backend environment dev from the cloud. - Uploading files... internal/process/per_thread.js:152 _memoryUsage(memValues); ^ Error: EMFILE: too many open files, uv_resident_set_memory at process.memoryUsage (internal/process/per_thread.js:152:5) at Object.getProcessInfo (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/exception.js:33:26) at Object.getAllInfo (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/exception.js:17:24) at Object._uncaughtException (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/logger.js:636:24) at process.emit (events.js:326:22) at process.emit (/snapshot/node_modules/source-map-support/source-map-support.js:495:21) at process._fatalException (internal/process/execution.js:165:25) { errno: -24, code: 'EMFILE', syscall: 'uv_resident_set_memory' } ⚠️ Amplify command hooks are disabled in the current execution environment. ⚠️ See https://docs.amplify.aws/cli/usage/command-hooks/ for more information. �[0m�[0m �[0m Current Environment: dev�[0m �[0m �[0m �[90m┌──────────�[39m�[90m┬───────────────�[39m�[90m┬───────────�[39m�[90m┬───────────────────┐�[39m �[90m│�[39m Category �[90m│�[39m Resource name �[90m│�[39m Operation �[90m│�[39m Provider plugin �[90m│�[39m �[90m├──────────�[39m�[90m┼───────────────�[39m�[90m┼───────────�[39m�[90m┼───────────────────┤�[39m �[90m│�[39m Api �[90m│�[39m altum �[90m│�[39m Update �[90m│�[39m awscloudformation �[90m│�[39m �[90m├──────────�[39m�[90m┼───────────────�[39m�[90m┼───────────�[39m�[90m┼───────────────────┤�[39m �[90m│�[39m Auth �[90m│�[39m altumfadb09ec �[90m│�[39m No Change �[90m│�[39m awscloudformation �[90m│�[39m �[90m└──────────�[39m�[90m┴───────────────�[39m�[90m┴───────────�[39m�[90m┴───────────────────┘�[39m �[32m�[39m �[32mGraphQL schema compiled successfully.�[39m �[32mEdit your schema at /tmp/amplify-ebcb6677-fa66-44d7-a2a4-93f123acf056/amplify/backend/api/altum/schema.graphql or place .graphql files in a directory at /tmp/amplify-ebcb6677-fa66-44d7-a2a4-93f123acf056/amplify/backend/api/altum/schema�[39m
-- | --
Command failed with exit code 7: /root/.amplify/bin/amplify push --yes - Fetching updates to backend environment: dev from the cloud. ✔ Successfully pulled backend environment dev from the cloud. - Uploading files... internal/process/per_thread.js:152 _memoryUsage(memValues); ^ Error: EMFILE: too many open files, uv_resident_set_memory at process.memoryUsage (internal/process/per_thread.js:152:5) at Object.getProcessInfo (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/exception.js:33:26) at Object.getAllInfo (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/exception.js:17:24) at Object._uncaughtException (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/logger.js:636:24) at process.emit (events.js:326:22) at process.emit (/snapshot/node_modules/source-map-support/source-map-support.js:495:21) at process._fatalException (internal/process/execution.js:165:25) { errno: -24, code: 'EMFILE', syscall: 'uv_resident_set_memory' } ⚠️ Amplify command hooks are disabled in the current execution environment. ⚠️ See https://docs.amplify.aws/cli/usage/command-hooks/ for more information. �[0m�[0m �[0m Current Environment: dev�[0m �[0m �[0m �[90m┌──────────�[39m�[90m┬───────────────�[39m�[90m┬───────────�[39m�[90m┬───────────────────┐�[39m �[90m│�[39m Category �[90m│�[39m Resource name �[90m│�[39m Operation �[90m│�[39m Provider plugin �[90m│�[39m �[90m├──────────�[39m�[90m┼───────────────�[39m�[90m┼───────────�[39m�[90m┼───────────────────┤�[39m �[90m│�[39m Api �[90m│�[39m altum �[90m│�[39m Update �[90m│�[39m awscloudformation �[90m│�[39m �[90m├──────────�[39m�[90m┼───────────────�[39m�[90m┼───────────�[39m�[90m┼───────────────────┤�[39m �[90m│�[39m Auth �[90m│�[39m altumfadb09ec �[90m│�[39m No Change �[90m│�[39m awscloudformation �[90m│�[39m �[90m└──────────�[39m�[90m┴───────────────�[39m�[90m┴───────────�[39m�[90m┴───────────────────┘�[39m �[32m�[39m �[32mGraphQL schema compiled successfully.�[39m �[32mEdit your schema at /tmp/amplify-99c958b4-4e6a-48e6-97a9-6628d21dc268/amplify/backend/api/altum/schema.graphql or place .graphql files in a directory at /tmp/amplify-99c958b4-4e6a-48e6-97a9-6628d21dc268/amplify/backend/api/altum/schema�[39m
FAILED | Command failed with exit code 7: /root/.amplify/bin/amplify push --yes - Fetching updates to backend environment: dev from the cloud. ✔ Successfully pulled backend environment dev from the cloud. - Uploading files... ✖ An error occurred when pushing the resources to the cloud internal/process/per_thread.js:152 _memoryUsage(memValues); ^ Error: EMFILE: too many open files, uv_resident_set_memory at process.memoryUsage (internal/process/per_thread.js:152:5) at Object.getProcessInfo (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/exception.js:33:26) at Object.getAllInfo (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/exception.js:17:24) at Object._uncaughtException (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/logger.js:636:24) at process.emit (events.js:326:22) at process.emit (/snapshot/node_modules/source-map-support/source-map-support.js:495:21) at process._fatalException (internal/process/execution.js:165:25) { errno: -24, code: 'EMFILE', syscall: 'uv_resident_set_memory' } ⚠️ Amplify command hooks are disabled in the current execution environment. ⚠️ See https://docs.amplify.aws/cli/usage/command-hooks/ for more information. �[0m�[0m �[0m Current Environment: dev�[0m �[0m �[0m �[90m┌──────────�[39m�[90m┬───────────────�[39m�[90m┬───────────�[39m�[90m┬───────────────────┐�[39m �[90m│�[39m Category �[90m│�[39m Resource name �[90m│�[39m Operation �[90m│�[39m Provider plugin �[90m│�[39m �[90m├──────────�[39m�[90m┼───────────────�[39m�[90m┼───────────�[39m�[90m┼───────────────────┤�[39m �[90m│�[39m Api �[90m│�[39m altum �[90m│�[39m Update �[90m│�[39m awscloudformation �[90m│�[39m �[90m├──────────�[39m�[90m┼───────────────�[39m�[90m┼───────────�[39m�[90m┼───────────────────┤�[39m �[90m│�[39m Auth �[90m│�[39m altumfadb09ec �[90m│�[39m No Change �[90m│�[39m awscloudformation �[90m│�[39m �[90m└──────────�[39m�[90m┴───────────────�[39m�[90m┴───────────�[39m�[90m┴───────────────────┘�[39m �[32m�[39m �[32mGraphQL schema compiled successfully.�[39m �[32mEdit your schema at /tmp/amplify-e8239636-dc6a-447d-9eb6-663258ef42cd/amplify/backend/api/altum/schema.graphql or place .graphql files in a directory at /tmp/amplify-e8239636-dc6a-447d-9eb6-663258ef42cd/amplify/backend/api/altum/schema�[39m 🛑 getaddrinfo EBUSY amplify-altum-dev-113248-deployment.s3.amazonaws.com �[31mAn error occurred during the push operation: getaddrinfo EBUSY amplify-altum-dev-113248-deployment.s3.amazonaws.com�[39m
-- | --
Command failed with exit code 7: /root/.amplify/bin/amplify push --yes - Fetching updates to backend environment: dev from the cloud. ✔ Successfully pulled backend environment dev from the cloud. - Uploading files... internal/process/per_thread.js:152 _memoryUsage(memValues); ^ Error: EMFILE: too many open files, uv_resident_set_memory at process.memoryUsage (internal/process/per_thread.js:152:5) at Object.getProcessInfo (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/exception.js:33:26) at Object.getAllInfo (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/exception.js:17:24) at Object._uncaughtException (/snapshot/node_modules/cfn-lint/node_modules/winston/lib/winston/logger.js:636:24) at process.emit (events.js:326:22) at process.emit (/snapshot/node_modules/source-map-support/source-map-support.js:495:21) at process._fatalException (internal/process/execution.js:165:25) { errno: -24, code: 'EMFILE', syscall: 'uv_resident_set_memory' } ⚠️ Amplify command hooks are disabled in the current execution environment. ⚠️ See https://docs.amplify.aws/cli/usage/command-hooks/ for more information. �[0m�[0m �[0m Current Environment: dev�[0m �[0m �[0m �[90m┌──────────�[39m�[90m┬───────────────�[39m�[90m┬───────────�[39m�[90m┬───────────────────┐�[39m �[90m│�[39m Category �[90m│�[39m Resource name �[90m│�[39m Operation �[90m│�[39m Provider plugin �[90m│�[39m �[90m├──────────�[39m�[90m┼───────────────�[39m�[90m┼───────────�[39m�[90m┼───────────────────┤�[39m �[90m│�[39m Api �[90m│�[39m altum �[90m│�[39m Update �[90m│�[39m awscloudformation �[90m│�[39m �[90m├──────────�[39m�[90m┼───────────────�[39m�[90m┼───────────�[39m�[90m┼───────────────────┤�[39m �[90m│�[39m Auth �[90m│�[39m altumfadb09ec �[90m│�[39m No Change �[90m│�[39m awscloudformation �[90m│�[39m �[90m└──────────�[39m�[90m┴───────────────�[39m�[90m┴───────────�[39m�[90m┴───────────────────┘�[39m �[32m�[39m �[32mGraphQL schema compiled successfully.�[39m �[32mEdit your schema at /tmp/amplify-e61ef032-1583-4ec4-8d29-b99e8a26fb5d/amplify/backend/api/altum/schema.graphql or place .graphql files in a directory at /tmp/amplify-e61ef032-1583-4ec4-8d29-b99e8a26fb5d/amplify/backend/api/altum/schema�[39m

These errors seemingly went away, but the backend is still not updating despite a successful deploy being shown.

@dperconti
Copy link
Author

Also potentially related:

The datastore page intermittently fails to load, showing a blank screen and this error in the console

Screen Shot 2021-10-13 at 11 43 56 AM

@ghost ghost added the backend-builds label Oct 13, 2021
@Parkseokje
Copy link

I am experiencing a similar situation.
I tried 4.29.4 but it didn't work. and the build failed with a 30 minutes timeout.

2021-10-14T09:56:54.599Z [INFO]: # Continuing with frontend build and deploy...
2021-10-14T09:56:54.600Z [INFO]: # Ensuring NPM package '@aws-amplify/cli' is version: '4.29.4'
2021-10-14T09:56:58.713Z [INFO]: # Last deployed commit: 6c1ea6049a541a09941d1dc4686c44e7f04d528a
2021-10-14T09:56:58.961Z [INFO]: # Retrieving cache...
2021-10-14T09:57:04.550Z [INFO]: # Extracting cache...
2021-10-14T09:57:07.926Z [INFO]: # Extraction completed
                                 ## Checking for associated backend environment...
                                 ## Backend environment association found
2021-10-14T09:57:35.014Z [INFO]: 

@ghost
Copy link

ghost commented Oct 14, 2021

Hi Donato and Park👋🏽, thanks for raising this and providing additional info. We're currently looking into this.

@24jr
Copy link

24jr commented Nov 4, 2021

How did people solve this? This is how my yml is should I change something. Used sveltekit and adapter-node to build and makes build folder in root of app. Have an amplify admin ui backend with auth enabled and one data table

2021-11-04T05:37:01.317Z [WARNING]: - Fetching updates to backend environment: staging from the cloud.
2021-11-04T05:37:01.720Z [WARNING]: ✔ Successfully pulled backend environment staging from the cloud.
2021-11-04T05:37:01.771Z [WARNING]: ✖ There was an error initializing your environment.

version: 1
backend:
  phases:
    build:
      commands:
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - npm install
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: build

also tried this based off one above and same thing

version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - npm install
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

@24jr
Copy link

24jr commented Nov 14, 2021

This is actually similar to a previous issue I had side stepped. For svelte-kit + adapter-static + vite + aws-amplify when running for example amplify pull --appId d2zuoroq5jzalo --envName staging there is no sveltekit option for framework I choose javascript and default other stuff until going through the steps when asked if I want to update the backend locally if I say no it works (and then if I want to edit the graphql schema for example I just do the same thing amplify pull --appId d2zuoroq5jzalo --envName staging but in an empty folder and say yes in there but seperate from the svelte-kit app. Or update the database through the admin ui.

I was fine not updating the backend through the svelte-kit repo and moved on. Ive run npm run build with adapter-static and through the admin ui attempted to add my front end repository but got ✖ There was an error initializing your environment.1 I now figured I would try instead of through the admin ui to do it through the cli and must be able to update the backend locally. then as you recall when choosing Y for updating backend locally got same error ✖ There was an error initializing your environment. so I'm guessing its the same issue in both places.

Some other things I've come across in my journey to use svelte-kit + vite + aws-amplify

#1298
aws-amplify/amplify-js#9639
aws/aws-sdk-js#3673

@ErikCH

So if build locally npm run dev works fine, npm run build and npm run preview work fine but not the final build for hosting

This is project I'm trying to use https:/24jr/agility

Also trying to host in Vercel https://vercel.com/ which I believe is relevant because saw rich harris the svelte kit guy is working with them now to push svelte so was trying on there but not sure how to get aws-exports to not be gitignore and not be found or how that all works but i do see it says not to edit gitignore

.DS_Store
node_modules
/build
/.svelte-kit
/package

#amplify-do-not-edit-begin
amplify/\#current-cloud-backend
amplify/.config/local-*
amplify/logs
amplify/mock-data
amplify/backend/amplify-meta.json
amplify/backend/.temp
build/
dist/
node_modules/
aws-exports.js
awsconfiguration.json
amplifyconfiguration.json
amplifyconfiguration.dart
amplify-build-config.json
amplify-gradle-config.json
amplifytools.xcconfig
.secret-*
**.sample
#amplify-do-not-edit-end

@abhi7cr abhi7cr added the bug Something isn't working label Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend-builds bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants