aws-amplify / aws-amplify/amplify-cli
amplify state file with added commands fails push and cicd build
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### How did you install the Amplify CLI?
npm
### If applicable, what version of Node.js are you using?
_No response_
### Amplify CLI Version
12.4.0
### What operating system are you using?
Mac
### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
well amplify.state is custom
### Describe the bug
When creating a function with custom build script in `amplify.state`.
say we add the build scripts with` npm install && echo 'hello world'` the push and build will fail


but it appears adding the echo at the start(for example) will not throw the error.
### Expected behavior
document and fix if this is not expected
### Reproduction steps
1. amplify init
2. amplify add function -> `Choose the package manager that you want to use: ` as custom or any manager
3. in the `amplify.state` add say
```
{
"pluginId": "amplify-nodejs-function-runtime-provider",
"functionRuntime": "nodejs",
"useLegacyBuild": true,
"defaultEditorFile": "src/index.js",
"scripts": {
"build": "npm install && "echo 'hello world'"
}
}
```
4. amplify push and observe error
### Project Identifier
_No response_
### Log output
```
# Put your logs below this line
```
### Additional information
_No response_
### Before submitting, please confirm:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
Contributor guide
Research direction
Reproduce the failure with the documented amplify init, amplify add function, and amplify push steps, using the custom scripts.build value in amplify.state. Start by tracing how that state entry is handled during the function build, then verify whether push and CI/CD builds succeed or the expected behavior is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100