Im trying to deploy a NextJS app (Just one page /home
) from a monorepo present in AWS CodeCommit via AWS Amplify. The deployment is successful and when opening the page I always get that the page is not working such that the page is currently unable to handle this request with 500 internal server error. But when I run the same in my local (either via yarn dev
or yarn build
followed by yarn start
), I could see my app running successfully fine with no issues.
The corresponding amplify.yml file for this deployment of Next App within a monorepo is as follows
version: 1
applications:
- frontend:
phases:
preBuild:
commands:
- rm -rf node_modules && yarn install --frozen-lockfile
build:
commands:
- yarn build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
appRoot: apps/staticSites
Edit: When looking into cloudwatch logs, found that there is an error log Error: Cannot find module '@swc/helpers/lib/_async_to_generator.js'
. After seeing this log, I made my nextjs app to use babel instead of swc to see whether it is working now, by creating a .babelrc file in which I added below lines
{
"presets": ["next/babel"]
}
But still seeing same log in cloudwatch. Also tried to include @swc/helpers package but still no improvements.
Could anyone let me know how to overcome this issue which Im not able to replicate in my local