aws-amplify / aws-amplify/amplify-hosting

Error: Cannot find module '@swc/helpers/lib/_async_to_generator.js'

Open
#3,153 9 comments 2 reactions 1 assignee Assigned to @Jay2113 View on GitHub
bug investigating monorepo
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 bug reports](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [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.

### App Id

d1luczyjzxi40j

### AWS Region

us-east-2

### Amplify Hosting feature

Frontend builds

### Describe the bug

Scenario 1:
1. Start to host a Nextjs 12 app (appID: d1luczyjzxi40j)
2. When the build is done, to do domain
3. Got 500 errors from CloudFront

![image](https://user-images.githubusercontent.com/11983489/204624680-b32b58f4-59e4-49bd-9830-95b9ae98388f.png)

4. Cloudwatch logged error
> Error: Cannot find module '@swc/helpers/lib/_async_to_generator.js'

5. Ping `@swc/helpers` version to `0.4.14`
6. Issue persists.

Scenario 2:
If I start with a Nextjs 11 app, the issue can be fixed.
1. Start to host a Nextjs 11 app (appID: d3sci3ahfz8hus, appID: d2213k35dz5phy)
2. Migrate to Nextjs12
3. Same as Scenario 1, 2-4.
4. Ping `@swc/helpers` version to `0.4.14`
5. The issue is resolved

Scenario 2 is not reproducable.

### Expected behavior

Nextjs 12 app should should up without 5xx errors or `Error: Cannot find module '@swc/helpers/lib/_async_to_generator.js' `.

### Reproduction steps

Nextjs 12 app got 5xx errors with the following error in CloudWatch...
> Error: Cannot find module '@swc/helpers/lib/_async_to_generator.js'

### Build Settings

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.