aws-amplify / aws-amplify/amplify-hosting

Amplify Gen2 application Build Failure Issue.

Open
#4,060 3 comments 0 reactions 0 assignees View on GitHub
pending-triage transferred
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Environment information

```plain text
package.json file :

{
"name": "test-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "NODE_OPTIONS='--inspect' next dev",
"build": "next build",
"start": "next start",
"prettier:fix": "prettier './src/**/*.js' --write",
"eslint:fix": "eslint ./src --fix",
"codeStyle:fix": "npm run prettier:fix && npm run eslint:fix",
"clear-all": "rimraf ./node_modules ./.next"
},
"eslintConfig": {
"extends": [
"react-app"
]
},
"browserslist": {
"production": [
">0.5%",
"last 2 versions",
"Firefox ESR",
"not dead",
"not IE 11",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"dependencies": {
"@aws-amplify/adapter-nextjs": "^1.5.0",
"@aws-amplify/ui-react": "^6.9.1",
"@aws-sdk/client-ses": "^3.803.0",
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.13.3",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@gsap/react": "^2.1.2",
"@livechat/widget-react": "^1.3.4",
"@mui/icons-material": "^6.1.1",
"@mui/material": "^6.1.1",
"@portabletext/react": "^3.2.1",
"@sanity/client": "^7.2.1",
"@sanity/image-url": "^1.1.0",
"aos": "^2.3.4",
"aws-amplify": "^6.13.0",
"card-validator": "^10.0.0",
"formik": "^2.4.5",
"gsap": "^3.12.7",
"html-react-parser": "^5.2.5",
"jarallax": "^2.1.4",
"next": "^14.2.13",
"next-sanity": "^9.11.1",
"nodemailer": "^6.10.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-countup": "^6.5.0",
"react-dom": "^18.2.0",
"react-slick": "^0.30.2",
"react-syntax-highlighter": "^15.5.0",
"react-visibility-sensor": "^5.1.1",
"slick-carousel": "^1.8.1",
"stripe": "^17.6.0",
"styled-components": "^6.1.18",
"xstate": "^5.19.3",
"xstate-v4": "npm:xstate@^4.38.3",
"yup": "^1.3.2"
},
"devDependencies": {
"@aws-amplify/backend": "^1.14.1",
"@aws-amplify/backend-cli": "^1.4.10",
"@babel/core": "^7.23.6",
"@babel/plugin-syntax-flow": "^7.23.3",
"@babel/plugin-transform-react-jsx": "^7.23.4",
"@types/styled-components": "^5.1.34",
"aws-cdk": "^2.178.2",
"aws-cdk-lib": "^2.178.2",
"constructs": "^10.4.2",
"cross-env": "^7.0.3",
"esbuild": "^0.25.0",
"eslint": "^9.11.1",
"eslint-plugin-react": "^7.37.0",
"prettier": "^3.1.1",
"rimraf": "^6.0.1",
"tsx": "^4.19.2",
"typescript": "^5.7.3",
"yarn-upgrade-all": "^0.7.2"
},
"resolutions": {
"@smithy/core": "3.3.3",
"@aws-sdk/types": "3.734.0"
}
}
```

### Describe the bug

Hello Team,

Amplify application build failing with below two errors.

----------------------
Error 1 :

2025-05-20T18:18:32.261Z [INFO]: [AuthenticationError] Unable to deploy due to insufficient permissions
∟ Caused by: [_AuthenticationError] Unable to resolve AWS account to use. It must be either configured when you define your CDK Stack, or through the environment
Resolution: Check the Caused by error and ensure you have the necessary permissions

Error 2 :

[WARNING]: /codebuild/output/src2094350622/src/Oripa/node_modules/@parcel/watcher/index.js:26

throw new Error(`No prebuild or local build of @parcel/watcher found. Tried ${name}. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.`);

Error: No prebuild or local build of @parcel/watcher found. Tried @parcel/watcher-linux-x64-glibc. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.

-----------------------

Checked and Verified the IAM permissions and "amplify.yml" build settings but there is no any permissions issue or build setting issue.

----------------------------
version: 1
backend:
phases:
build:
commands:
- nvm install 20
- nvm use 20
- 'yarn install --frozen-lockfile'
- 'yarn ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID --debug true'
frontend:
phases:
build:
commands:
- 'npm run build'
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- 'node_modules/**/*'
----------------------------

To resolve this issue we updated the "amplify.yml" file with below config and perform additional steps on local system.

---------------
1. Removed the "package-lock.json" file and "yarn.lock" file.
2. Removed the "node_modules" directory.
3. Installed the modules again using "npm install"
4. Updated files in GitHub repository
---------------

-----------------
version: 1
backend:
phases:
build:
commands:
- nvm install 20
- nvm use 20
- npm install --legacy-peer-deps --force
- npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID
frontend:
phases:
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- "**/*"
cache:
paths:
- .next/cache/**/*
- .npm/**/*
-----------------

We checked the "amplify.yml" for other working application but we have not identified any issue related to "build settings" and IAM permissions. Amplify application deployment successful with "yarn" package manager and build settings so we are not able to trace down the root cause of this build failure issue.

- Could you please confirm based on build errors if the issue arise due to npm package dependencies or some package version misconfig issue ?

### Reproduction steps

Issue not reproduce with sample application.

Contributor guide

Open the contributing guide

Research direction

Start with package.json and amplify.yml, then compare the npm and Yarn installation paths against the backend pipeline-deploy logs for the account-resolution and @parcel/watcher failures. Since the issue has no reproducible sample, done means identifying a reproducible cause and documenting a verified build configuration or dependency fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, next.js, node.js, react, typescript
Domain
build-system, 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.