aws-amplify / aws-amplify/amplify-cli
unable to run `amplify export` in a fresh project before pushing when an error is expected
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### Before opening, please confirm:
- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-cli/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-cli/blob/master/CONTRIBUTING.md#bug-reports).
- [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.
### How did you install the Amplify CLI?
pnpm
### If applicable, what version of Node.js are you using?
v16.13.1
### Amplify CLI Version
7.6.15
### 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
### Amplify Categories
function
### Amplify Commands
export
### Describe the bug
When reproducing [this issue](https://github.com/aws-amplify/amplify-cli/issues/9636) where we were expecting an error with exporting the Lambda Layer, I noticed the export command would hang on `Building and packaging resources` where it appears to have swallowed the error.

(for reference, I quit this process after about 10mins)
In order to receive the error I was looking for I needed to first push my new resources with `amplify push -y` and then re-run `amplify export --out tmp`
### Expected behavior
CLI prints a helpful error message and exits / does not hang.
### Reproduction steps
1. create a new project `amplify init -y`
2. add a Lambda Layer with `amplify add function`
3. `amplify export --out tmp`
4. observe CLI hangs
### GraphQL schema(s)
```graphql
# Put schemas below this line
```
### Log output
```
# Put your logs below this line
```
### Additional information
_No response_
Contributor guide
Research direction
Start by reproducing the issue with `amplify init -y`, `amplify add function`, and `amplify export --out tmp`, then compare it with a project after `amplify push -y`. Trace the `export` command while it reports “Building and packaging resources”; done means the expected error is printed and the command exits instead of hanging.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100