Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📝 WalkthroughWalkthroughThe changes introduce centralized AWS Lambda Node.js runtime support constants and update the serverless dev command to use the local Node.js version when compatible with Lambda, falling back to nodejs20.x with warnings when not supported. This enables durable functions requiring Node 22+ to run correctly in dev mode. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/serverless/test/unit/lib/plugins/aws/dev.test.js (1)
125-145: Test correctly verifies the supported-runtime path, but consider also asserting warning count.The test validates the runtime is set to
nodejs22.xand the mismatch warning fires. For parity with the unsupported-runtime test (which assertstoHaveBeenCalledTimes(1)), consider adding atoHaveBeenCalledTimes(1)assertion here too, to ensure only the mismatch warning fires and no spurious fallback warning is emitted.Suggested addition
expect(functionConfig.runtime).toBe('nodejs22.x') + expect(mockLogger.warning).toHaveBeenCalledTimes(1) expect(mockLogger.warning).toHaveBeenCalledWith(🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/serverless/test/unit/lib/plugins/aws/dev.test.js` around lines 125 - 145, Add an assertion that the mismatch warning was called exactly once to mirror the unsupported-runtime test: after the existing expects in the describe '#update()' it block (the one that sets runtime to nodejs22.x and checks mockLogger.warning was called with the mismatch message), add an assertion using mockLogger.warning and toHaveBeenCalledTimes(1). Reference the test's awsDev.update invocation, the functionConfig object, and mockLogger.warning to place the new expectation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/serverless/test/unit/lib/plugins/aws/dev.test.js`:
- Around line 125-145: Add an assertion that the mismatch warning was called
exactly once to mirror the unsupported-runtime test: after the existing expects
in the describe '#update()' it block (the one that sets runtime to nodejs22.x
and checks mockLogger.warning was called with the mismatch message), add an
assertion using mockLogger.warning and toHaveBeenCalledTimes(1). Reference the
test's awsDev.update invocation, the functionConfig object, and
mockLogger.warning to place the new expectation.
|
@cursor review |
Summary
nodejs20.xnodejs20.xwith a warning when the local Node.js version is not yet supported by AWS LambdaAWS_LAMBDA_SUPPORTED_NODE_RUNTIMESlist (18.x,20.x,22.x,24.x) inpackages/serverless/lib/plugins/aws/dev/index.js, decoupled from the local-lambda wrapper's broader runtime support list (which also includes deprecated14.x/16.x)SUPPORTED_NODE_RUNTIMESconst inpackages/serverless/lib/plugins/aws/dev/local-lambda/index.jsfor readabilityTest plan
nodejs22.x)nodejs20.xwith a single warning when local version is unsupported (e.g., local v26)dev.test.js+local-lambda.test.js)Closes #13355
Summary by CodeRabbit
Bug Fixes
Tests
Note
Low Risk
Behavior is limited to Dev Mode shim configuration and logging, with added unit coverage; main risk is unexpected runtime selection for edge Node versions.
Overview
Dev Mode no longer hardcodes the shim runtime to
nodejs20.x; it now selects the local Node.js major version as the Lambda runtime when it’s in an allowlist, otherwise falls back tonodejs20.xand emits a single warning explaining the fallback.Runtime mismatch warnings are refined to avoid duplicate/confusing messaging when the fallback path is taken,
local-lambdaruntime wrapper versions are refactored into a namedSUPPORTED_NODE_RUNTIMESconstant, and unit tests add coverage for the supported-runtime and unsupported-runtime fallback scenarios (including logger warning assertions).Written by Cursor Bugbot for commit 9dc6083. This will update automatically on new commits. Configure here.