Remove support for node 18 and earlier#152
Merged
GrahamCampbell merged 4 commits intomainfrom Apr 18, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the codebase to require newer Node.js versions and modernizes HTTP fetching by removing node-fetch usage in favor of the built-in fetch (plus undici where needed), while also updating the default AWS Lambda Node runtime references in tests/fixtures/docs.
Changes:
- Drop support for running the project on Node.js < 20 (engines, CLI guard, CI, and pkg build targets).
- Replace
node-fetchusage with globalfetchand update proxy/stream handling accordingly (undiciProxyAgent, web stream conversions). - Update tests, fixtures, and docs to reflect
nodejs20.xas the Node Lambda runtime baseline (and remove older Node Lambda runtimes from allowed runtime lists/types).
Reviewed changes
Copilot reviewed 90 out of 93 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| types/index.d.ts | Removes older Node Lambda runtime literals and reformats string literal quoting. |
| test/utils/integration.js | Switches to global fetch with updated header/body logging for native fetch APIs. |
| test/unit/lib/utils/fs/safe-move-file.test.js | Removes an outdated Node version–specific comment. |
| test/unit/lib/utils/download-template-from-repo.test.js | Stubs globalThis.fetch instead of proxyquiring node-fetch. |
| test/unit/lib/plugins/plugin/lib/utils.test.js | Stubs globalThis.fetch and removes proxyquire usage for fetch. |
| test/unit/lib/plugins/aws/rollback-function.test.js | Stubs globalThis.fetch and updates buffer handling to arrayBuffer(). |
| test/unit/lib/plugins/aws/package/lib/strip-null-props-from-template-resources.test.js | Updates expected runtime to nodejs20.x. |
| test/unit/lib/plugins/aws/package/compile/layers.test.js | Updates layer compatible runtimes assertions to nodejs20.x. |
| test/unit/lib/plugins/aws/package/compile/functions.test.js | Updates many function runtime expectations and default runtime assertion to nodejs20.x. |
| test/unit/lib/plugins/aws/invoke-local/index.test.js | Updates runtime expectations and docker image tags from nodejs18.x to nodejs20.x. |
| test/unit/lib/plugins/aws/deploy/lib/upload-artifacts.test.js | Removes outdated mention of Node v6 in a race-condition comment. |
| test/unit/lib/plugins/aws/custom-resources/index.test.js | Updates custom-resources runtime expectations to nodejs20.x. |
| test/integration-package/fixtures/regular/serverless.yml | Updates fixture provider runtime to nodejs20.x. |
| test/integration-package/fixtures/individually/serverless.yml | Updates fixture provider runtime to nodejs20.x. |
| test/integration-package/fixtures/individually-function/serverless.yml | Updates fixture provider runtime to nodejs20.x. |
| test/integration-package/fixtures/artifact/serverless.yml | Updates fixture provider runtime to nodejs20.x. |
| test/integration-package/cloudformation.tests.js | Updates CloudFormation runtime expectations to nodejs20.x. |
| test/fixtures/programmatic/websocket/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/websocket-external-auth/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/variables-legacy/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/stream/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/sqs/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/sns/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/schedule/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/s3/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/request-schema/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/request-parameters/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/provisioned-concurrency/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/plugin/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/packaging/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/package-artifact/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/package-artifact-in-serverless-dir/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/multi-service/service-a/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/layer/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/iot/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/iot-fleet-provisioning/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/invocation/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/http-api/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/http-api-export/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/http-api-catch-all/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/function/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/function-rabbit-mq/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/function-msk/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/function-layers/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/function-efs/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/function-cloud-front/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/function-active-mq/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/event-bridge/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/ecr/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/ecr/Dockerfile.dev | Updates Lambda base image from Node 12 to Node 20. |
| test/fixtures/programmatic/ecr/Dockerfile | Updates Lambda base image from Node 12 to Node 20. |
| test/fixtures/programmatic/curated-plugins/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/config-schema-extensions-error/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/cognito-user-pool/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/check-for-changes/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/api-gateway/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/programmatic/api-gateway-extended/serverless.yml | Updates fixture runtime to nodejs20.x. |
| test/fixtures/cli/variables/serverless.yml | Updates fixture runtime to nodejs20.x. |
| scripts/pkg/upload/world.js | Uses global fetch and adapts request body streaming to web streams (Readable.toWeb, duplex: 'half'). |
| scripts/pkg/upload/index.js | Removes outdated Node version comment. |
| scripts/pkg/build.js | Updates script minimum Node comment, npm version pin, and pkg targets to Node 20. |
| prettier.config.js | Replaces inherited config with explicit Prettier settings (single quotes, print width, etc.). |
| package.json | Removes node-fetch, adds undici, updates eslint config, and sets engines to Node >= 20. |
| lib/utils/standalone.js | Removes node-fetch import and relies on global fetch. |
| lib/utils/require-with-import-fallback.js | Replaces helper-based ESM import with direct import(file://...). |
| lib/utils/log-deprecation.js | Changes deprecation error/summary messaging (removes “More info” link emission). |
| lib/utils/import-esm.js | Deletes the legacy helper used for dynamic ESM imports on older Node. |
| lib/utils/download-template-from-repo.js | Removes node-fetch import and relies on global fetch. |
| lib/plugins/standalone.js | Removes node-fetch and adapts download piping from web streams (Readable.fromWeb). |
| lib/plugins/plugin/lib/utils.js | Replaces https-proxy-agent usage with undici ProxyAgent via dispatcher. |
| lib/plugins/package/lib/package-service.js | Updates default Lambda runtime to nodejs20.x. |
| lib/plugins/aws/rollback-function.js | Removes node-fetch and switches to fetch(...).arrayBuffer() -> Buffer. |
| lib/plugins/aws/provider.js | Removes older Node Lambda runtimes from allowed list and updates default runtime to nodejs20.x. |
| lib/plugins/aws/package/compile/events/sns.js | Simplifies ARN split logic using regex lookbehind (requires modern Node). |
| lib/plugins/aws/invoke-local/index.js | Updates ESM fallback import to direct import(file://...). |
| lib/plugins/aws/custom-resources/resources/api-gateway-cloud-watch-role/handler.js | Minor conditional formatting simplification. |
| lib/plugins/aws/custom-resources/index.js | Changes how provider Node runtimes are selected for custom resource lambdas. |
| lib/configuration/read.js | Switches .mjs loading to direct import(file://...). |
| docs/guides/variables.md | Updates example runtime to nodejs20.x. |
| docs/guides/services.md | Updates example runtimes to nodejs20.x. |
| docs/guides/serverless.yml.md | Updates example runtimes to nodejs20.x. |
| docs/guides/plugins/creating-plugins.md | Removes outdated Node 12.22 wording for ESM plugin support. |
| docs/guides/functions.md | Updates example runtimes to nodejs20.x and adjusts a note. |
| docs/guides/credentials.md | Updates example runtimes to nodejs20.x. |
| docs/getting-started.md | Documents Node 20+ requirement. |
| docs/events/websocket.md | Updates example runtime to nodejs20.x. |
| docs/events/cloudfront.md | Updates listed Lambda@Edge runtime limits. |
| docs/events/apigateway.md | Updates example runtime to nodejs20.x. |
| docs/cli-reference/print.md | Updates example runtime to nodejs20.x. |
| bin/serverless.js | Raises the CLI minimum supported Node major version to 20. |
| README.md | Notes Node 20+ requirement and removes some “Learn More” links. |
| .github/workflows/validate.yml | Updates CI to Node 20/22 jobs (drops Node 16). |
| .github/workflows/publish.yml | Normalizes permissions formatting (and uses Node 22 in workflow). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.