aws-amplify / aws-amplify/amplify-cli
malformed headless pull produce ambiguous error
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### How did you install the Amplify CLI?
pnpm
### If applicable, what version of Node.js are you using?
18
### Amplify CLI Version
11.0.0-beta.8
### 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.
n/a
### Describe the bug
As I was reproducing https://github.com/aws-amplify/amplify-cli/issues/12120 I noticed if the headless payload for headless pull is malformed we receive an ambiguous error
```sh
# my-pull.sh
cat <<- 'EOF' > ~/.aws/config
[profile gladly]
credential_process=bash -c 'echo "{ \"Version\": 1, \"AccessKeyId\": \"${AWS_ACCESS_KEY_ID}\", \"SecretAccessKey\": \"${AWS_SECRET_ACCESS_KEY}\", \"SessionToken\": \"${AWS_SESSION_TOKEN}\", \"Expiration\": \"2031-11-24T17:12:42+00:00\" }"'
region=ap-southeast-2
EOF
REACTCONFIG="Not Relevant"
AMPLIFY="Not Releavnt"
FRONTEND="Not Relevant"
AWSCLOUDFORMATIONCONFIG="{\
\"configLevel\": \"project\",\
\"useProfile\": true,\
\"profileName\": \"gladly\",\
\"region\": \"ap-southeast-2\"\
}"
PROVIDERS="{\
\"awscloudformation\":$AWSCLOUDFORMATIONCONFIG\
}"
amplify pull \
--appId $APPID \
--amplify $AMPLIFY \
--frontend $FRONTEND \
```
```console
➜ sh my-pull.sh
🛑 Cannot create property 'providers' on string 'Not'
Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
Session Identifier: 74572c22-8a60-4bb2-8807-15c307e8836f
```
### Expected behavior
Error message is more descriptive
```console
➜ sh my-pull.sh
🛑 Payload is malformed. 'providers' not found, but is required
Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
Session Identifier: 74572c22-8a60-4bb2-8807-15c307e8836f
```
### Reproduction steps
1. copy shell script
2. execute shell script
3. 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
Assessment
This issue has not been assessed yet.