Serverless CI/CD NodeJs Engine incompatibility

Serverless CI/CD NodeJs Engine incompatibility

a year ago, March 8, 2023
Reading time: 2 mins

I had been using Serverless framework’s CI/CD feature to deploy my serverless app to aws on update in github branch.

Today I decided to upgrade my lambda runtime to v.18 and suddenly CI builds started failing.

The CI environment of serverless started to use Nodejs v.12

Build started at Wed Mar 08 2023 18:48:16 GMT+0000 (GMT)
> node --version
v12.22.11
> npm --version
6.14.16
> npx serverless --version
Framework Core: 3.28.1 (local)

I had been doing number of other changes so I just could not figure out why suddenly CI is using older nodeJs version, which most of the serverless plugins did non support as shown below

Serverless-offline requires NodeJs v.14+

build step: yarn install
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
error serverless-offline@12.0.4: The engine "node" is incompatible with this module. Expected version ">=14.18.0". Got "12.22.11"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
build step failed: yarn install
Deploy failed!
Error: build step failed: yarn install

Domain manager as well

error serverless-domain-manager@6.4.4: The engine "node" is incompatible with this module. Expected version ">=14". Got "12.22.11"
error Found incompatible module.

@aws-sdk v3. requires Nodejs version >=14 too.

After failing to answer anywhere on the internet, it struck to me that I had changed the runtime node version to 18, I decided to downgrade it to 16 and then CI environment matched it and switched to NodeJs v.16 so the build passed again.

Build started at Wed Mar 08 2023 19:00:12 GMT+0000 (GMT)
> node --version
v16.15.0
> npm --version
8.5.5
> npx serverless --version
Framework Core: 3.28.1 (local)
Plugin: 6.2.3
SDK: 4.3.2
> serverless-build --info
Runtime: nodejs16.x
Build: 9172070
Runner: 0.7.6
Provider: GITHUB

successfully checked out git commit 8489ee9b4a377ca224bc380591085e9e3e766039
build step: yarn install
yarn install v1.22.18
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 46.16s.
build step succeeded: yarn install
Previous
Cheap DIY Stream deck alternative
Next
Smart temperature control for a cheap Soldering iron
© 2024 Anil Maharjan