Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDK Deployment crashes: Dockerfile aws-lambda-nodejs/lib/Dockerfile has unsupported version of NodeJs 14 for new pnpm version #24820

Closed
olehvic opened this issue Mar 28, 2023 · 17 comments
Labels
@aws-cdk/aws-ecr Related to Amazon Elastic Container Registry bug This issue is a bug. p0

Comments

@olehvic
Copy link

olehvic commented Mar 28, 2023

Hi there,

it is unfortunately not possible to deploy aws cdk chages since today.
pnpm dependency was updated today to the latest version v8. (GithubV8ReleaseLink)

pnpm v8 is not compatible with Node.js v. 14 (see https://pnpm.io/installation#compatibility)
The dockerfile aws-lambda-nodejs/lib/Dockerfile uses image: ARG IMAGE=public.ecr.aws/sam/build-nodejs14.x

Expected Behavior

Deployment should be completed without error code

Current Behavior

Error: Process completed with exit code 1. CI/CD pipeline is down.

Reproduction Steps

Logs:

Status: Downloaded newer image for public.ecr.aws/sam/build-nodejs14.x:latest
 ---> 9c9804a54385
Step 3/13 : RUN npm install --global [email protected]
 ---> Running in 5b593ca94cf4
/var/lang/bin/yarn -> /var/lang/lib/node_modules/yarn/bin/yarn.js
/var/lang/bin/yarnpkg -> /var/lang/lib/node_modules/yarn/bin/yarn.js
+ [email protected]
added 1 package in 0.36s
Removing intermediate container 5b593ca94cf4
 ---> a10828479684
Step 4/13 : RUN npm install --global pnpm
 ---> Running in add6e6fa94f7
/var/lang/bin/pnpm -> /var/lang/lib/node_modules/pnpm/bin/pnpm.cjs
/var/lang/bin/pnpx -> /var/lang/lib/node_modules/pnpm/bin/pnpx.cjs
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=16.14"} (current: {"node":"14.21.3","npm":"6.14.18"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]

+ [email protected]
...

Step 10/13 : RUN mkdir /tmp/pnpm-cache &&     chmod -R 777 /tmp/pnpm-cache &&     pnpm config --global set store-dir /tmp/pnpm-cache
 ---> Running in c886e7f701c2
ERROR: This version of pnpm requires at least Node.js v16.4
The current version of Node.js is v14.21.3

Possible Solution

Please update public.ecr.aws/sam/build-nodejs14.x:latest into v16.4.

Additional Information/Context

No response

CDK CLI Version

2.70.0

Framework Version

No response

Node.js Version

v18.13.0

OS

macOs

Language

Typescript

Language Version

Version 5.0.2

Other information

No response

@olehvic olehvic added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 28, 2023
@github-actions github-actions bot added the @aws-cdk/aws-ecr Related to Amazon Elastic Container Registry label Mar 28, 2023
@rehanvdm
Copy link

Having the same issue

@rehanvdm
Copy link

It should/might work if you explicitly specify the SAM base image version to use version 16 like:

dockerImage: DockerImage.fromRegistry('public.ecr.aws/sam/build-nodejs16.x:latest'),

https://gallery.ecr.aws/sam/build-nodejs16.x

@IamFlowZ
Copy link

Also taking our pipelines down.

@fielmann-deeb
Copy link

same here

@maestro1207
Copy link

Welcome in a club

@corymhall
Copy link
Contributor

We just merged a fix to this today #24821. We are working on getting this released.

@peterwoodworth peterwoodworth added p0 and removed needs-triage This issue or PR still needs to be triaged. labels Mar 28, 2023
@corymhall
Copy link
Contributor

v2 release #24824
v1 release #24833

@felipecornejo1
Copy link

in my case I was able to solve this by changing any places where we were using Runtime.NODEJS_14_X into Runtime.NODEJS_16_X. Obviously won't be as easy for everybody, but check if you're explicitly using node 14 in your code and if switching to 16 does the job

@joao-moonward
Copy link

joao-moonward commented Apr 3, 2023

I have the same issue:

    const dockerImageAsset = new ecrAssets.DockerImageAsset(
      this,
      StringFormatter.formatId("nest-app-docker-image"),
      {
        directory: path.join(__dirname, "../.."),
        platform: ecrAssets.Platform.LINUX_AMD64,
      }
    );

My docker file is like this:

FROM node:16-slim

My CDK version is: 2.55.0 (build 077d77d)
I also tried to update to this version: 2.72.1 (build ddbfac7)

[edit]

I also updated my package version from "aws-cdk-lib": "^2.43.1" to "aws-cdk-lib": "^2.72.0" and it seems to work.

Any idea?

@up1io
Copy link

up1io commented Apr 8, 2023

In my case, the problem was solved by specifically setting the runtime in the NodeJSFunction to Runtime.NODEJS_16_X. The default value from the aws-cdk-lib (v2.60.0) is Runtime.NODEJS_14_X if the runtime is not defined and this causes this error.

@airmonitor
Copy link

Try this one - https://dev.to/airmonitor/aws-cdk-arm64-codebuild-is-broken-2e9a

what you should change is the build_image=codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM_2 to x86_64 if you would like, but the pipeline has been changed to enforce node 16 everywhere.

@fl0wo
Copy link

fl0wo commented Apr 9, 2023

In my case, the problem was solved by specifically setting the runtime in the NodeJSFunction to Runtime.NODEJS_16_X. The default value from the aws-cdk-lib (v2.60.0) is Runtime.NODEJS_14_X if the runtime is not defined and this causes this error.

Same here! Thank you.

@corymhall
Copy link
Contributor

This should have been fixed with v2.72.0. If anyone is still seeing this error let me know.

@airmonitor
Copy link

@corymhall

Yes, this is still valid for ARM64 builds, the AMAZON_LINUX_2_ARM_2 build image only has node12 (because AWS didn't provide timely support for installing something more up-to-date).

@corymhall
Copy link
Contributor

@airmonitor I think your issue might be something else. This issue is specific to the NodejsFunction construct requiring nodejs 16 (should be fixed).

It sounds like you are talking about CDK in general not supporting nodejs 12?

@Mayhem93
Copy link

This should have been fixed with v2.72.0. If anyone is still seeing this error let me know.

This is how i got it mine fixed. Just upgrade to said version and re-deploy with no extra headaches

@mrgrain mrgrain closed this as completed Aug 24, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecr Related to Amazon Elastic Container Registry bug This issue is a bug. p0
Projects
None yet
Development

No branches or pull requests