I have setup a Codebuild for my nextjs project on aws
I get error while deploying
myNextApplication › TypeError: s3_static_assets_1.default is not a function
#buildspec.yml
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
commands:
- echo Installing source NPM dependencies
- npm install serverless -g --unsafe-perm=true --allow-root
- npm install --silent
- npm run build
build:
commands:
- npm run deploy
- echo Deployment completed
Logs
75s › myNextApplication › Deploying ...
--
975 | ·[NaNA·[G·[J
976 | 75s › myNextApplication › Deploying ...
977 | ·[NaNA·[G·[J
978 | error:
979 | TypeError: s3_static_assets_1.default is not a function
980 | at NextjsComponent.<anonymous> (/root/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/serverless-component/dist/component.js:138:45)
981 | at Generator.next (<anonymous>)
982 | at fulfilled (/root/.serverless/components/registry/npm/@sls-next/[email protected]/node_modules/@sls-next/serverless-component/dist/component.js:5:58)
983 | ·[G·[?25h·[G·[J
984 | 75s › myNextApplication › TypeError: s3_static_assets_1.default is not a function
985 | Â
986 | ·[G·[?25hnpm ERR! code ELIFECYCLE
987 | npm ERR! errno 1
988 | npm ERR! [email protected] deploy: `serverless`
989 | npm ERR! Exit status 1
990 | npm ERR!
991 | npm ERR! Failed at the [email protected] deploy script.
992 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
993 | Â
994 | npm ERR! A complete log of this run can be found in:
995 | npm ERR! /root/.npm/_logs/2020-11-05T11_05_03_244Z-debug.log
996 | Â
997 | [Container] 2020/11/05 11:05:03 Command did not exit successfully npm run deploy exit status 1
998 | [Container] 2020/11/05 11:05:03 Phase complete: BUILD State: FAILED
999 | [Container] 2020/11/05 11:05:03 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm run deploy. Reason: exit status 1
1000 | [Container] 2020/11/05 11:05:03 Entering phase POST_BUILD
Seeing the same issue on 1.15.1 gonna check with 1.18
This worked.
myNextApplication:
component: "@sls-next/[email protected]"
I am having this issue with 1.15.1 and I am using Github actions. I have this issue on new repo setup for another developer and we are trying to implement CI/CD. When I upgrade to @sls-next/[email protected] parts of my application break.
we are using "serverless-next.js": "^1.15.0-alpha.2"
"@sls-next/next-aws-cloudfront": "^1.4.1-alpha.0",
serverless 2.11.0
Most helpful comment
This worked.
myNextApplication:
component: "@sls-next/[email protected]"