aws-amplify / aws-amplify/amplify-hosting

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

Open
#2,318 8 comments 0 reactions 0 assignees View on GitHub
backend-builds bug question
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-console/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-console/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

### 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:

```bash
# Starting phase: build
2021-10-13T02:42:57.329Z [INFO]: Amplify AppID found: d39gw7seizrgo. Amplify App name is: Altum
2021-10-13T02:42:57.405Z [INFO]: Backend environment dev found in Amplify Console app: Altum
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]: 
GraphQL schema compiled successfully.
Edit 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
2021-10-13T02:43:01.178Z [INFO]: App not deployed yet.
2021-10-13T02:43:01.282Z [INFO]: Successfully generated models. Generated models can be found in /codebuild/output/src549484123/src/altum-web/src
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]: Note: It is recommended to run this command from the root of your app directory
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

```yaml
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

https://github.com/aws-amplify/amplify-console/issues/1787
https://github.com/aws-amplify/amplify-console/issues/1784
https://github.com/aws-amplify/amplify-console/issues/1298

All of these issues suggest changing the version of the CLI. I've tried with the following versions [from this page](https://www.npmjs.com/package/@aws-amplify/cli/v/6.3.0-beta.0) with no success:
```
6.2.1
6.1.1
5.6.0
5.5.0
5.3.0
5.0.1
4.52.0
```

Contributor guide

Open the contributing guide

Research direction

Start with the build settings and the amplifyPush --simple entry point, then inspect the build log around initialization of the production backend environment. Compare the production environment with the working environments and review related issues 1787, 1784, and 1298; done means the backend build completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
ci-cd, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.