serverless / serverless

⚡ Serverless Framework – Use AWS Lambda and other managed cloud services to build apps that auto-scale, cost nothing when idle, and boast radically low maintenance.

Home Page:https://serverless.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node minimum version requirements?

patricktyndall opened this issue · comments

Issue description

Builds using Node v14 and serverless@3.35.0 have started failing since Friday 3/29 with Error: Cannot find module 'node:events'.

Seems to be a node-version related issue, but this package lists node 12 as a supported runtime.

Can we fix this for node 14 (might need to pin a dependency, not sure which upstream package is failing)?

Alternatively, clearly document the node version requirement so this doesn't catch people by surprise?

Error: Cannot find module 'node:events'

Require stack:

- /usr/local/lib/node_modules/serverless/node_modules/simple-git/dist/cjs/index.js

- /usr/local/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/lib/deployment/parse.js

- /usr/local/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/lib/deployment/index.js

- /usr/local/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/lib/error-handler.js

- /usr/local/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/lib/plugin.js

- /usr/local/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/index.js

- /usr/local/lib/node_modules/serverless/lib/cli/handle-error.js

- /usr/local/lib/node_modules/serverless/scripts/serverless.js

Context

n/a

I had the same error, thank you, using nodejs 14 works.

Hi 👋.

I think that this is likely related to the latest release of the transitive dependency simple-git - there's a change in the most recent release that would appear to be causing the issue.

Hi, we're having the same issue when the automatic CI/CD tries to run.

Deploying locally works since that package is already installed, but as far as I can tell, whatever build host serverless.com uses for deploys does not have the 'events' package installed, so their own "serverless" node script cannot execute. My guess is that the dependency change @stuartmccoll mentioned caught serverless by surprise, and they haven't updated their build servers yet.

If my understanding of the situation correct? Is there a workaround, or do we just wait for serverless to fix the issue?

Build started at Fri Mar 29 2024 16:12:52 GMT+0000 (GMT)
> node --version
v14.15.5
> npm --version
6.14.11
> npx serverless --version
/usr/local/nvm/versions/node/v14.15.5/lib/node_modules/serverless/node_modules/essentials/index.js:21
		throw reason;
		^
Error: Cannot find module 'node:events'
Require stack:
- /usr/local/nvm/versions/node/v14.15.5/lib/node_modules/serverless/node_modules/simple-git/dist/cjs/index.js
- /usr/local/nvm/versions/node/v14.15.5/lib/node_modules/serverless/node_modules/@serverless/dashboard-plugin/lib/deployment/parse.js
...

Hi there folks. We upgraded the version of Node from 14 to 16 yesterday which should alleviate this issue. We attempted to upgrade higher but the Amazon images for the Python runtimes used in AWS Lambda have library dependency issues so we were limited there.

Resolved for me. Thanks.

Closing this issue as solved.

I am still seeing this issue in aws codebuild container. I have serverless@3.18.0 and nodejs 12.20.0. It is very difficult for us to upgrade to nodejs 16. Is there any workaround on it? Tried downgrading simple-git 3.22.0 but no luck. Please help as it is very critical for us.