aws-amplify / aws-amplify/amplify-hosting
Attempting to run pull with custom build scripts failing
- 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-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting questions](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have removed any sensitive information from my code snippets and submission.
### App Id
ddkfcre2qrht6
### AWS Region
us-east-1
### Amplify Hosting feature
Build settings
### Question
I am having trouble building on Amplify hosting using custom build scripts in amplify.yml. The script always gets hung up on whatever command I use before amplify pull. I need pull to bring in the aws-exports.js file and a post-pull script to run in order to modify that file. I have not even been able to get pull to run in the build process. Here is an example of the yml in one attempt:
```
version: 5
backend:
phases:
preBuild:
commands:
- npm config set //registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
- echo "@pqina:registry=https://npm.pqina.nl/" >> .npmrc
- echo "//npm.pqina.nl/:_authToken=${PQINA_NPM_TOKEN}" >> .npmrc
- npm i
build:
commands:
- echo "running build backend..."
- amplify pull --appId ddkfcre2qrht6 --envName test --yes
- echo "hello"
frontend:
phases:
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
```
Contributor guide
Research direction
Start with the amplify.yml build settings and reproduce the backend phase containing npm i and amplify pull --appId ddkfcre2qrht6 --envName test --yes. Check where the command hangs and whether the build environment can create aws-exports.js before the post-pull modification. Done means the pull completes and the following commands run successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript
- 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
- 20/100