Skip to content

Commit 1b21934

Browse files
bchewDorianMazur
andauthored
feat: add support for nodejs22.x runtime (#1837)
Co-authored-by: MazurDorian <mazur.dorian15@gmail.com>
1 parent d3519c2 commit 1b21934

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed

src/config/supportedRuntimes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const supportedRuntimesArchitecture = {
1515
"nodejs16.x": [ARM64, X86_64],
1616
"nodejs18.x": [ARM64, X86_64],
1717
"nodejs20.x": [ARM64, X86_64],
18+
"nodejs22.x": [ARM64, X86_64],
1819
"python3.7": [X86_64],
1920
"python3.8": [ARM64, X86_64],
2021
"python3.9": [ARM64, X86_64],
@@ -47,6 +48,7 @@ export const supportedNodejs = new Set([
4748
"nodejs16.x",
4849
"nodejs18.x",
4950
"nodejs20.x",
51+
"nodejs22.x",
5052
])
5153

5254
// PROVIDED

tests/integration/docker/multiple/serverless.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,11 @@ functions:
4444
path: hello3
4545
handler: handler.hello
4646
runtime: python3.8
47+
48+
hello4:
49+
events:
50+
- http:
51+
method: get
52+
path: hello4
53+
handler: handler.hello
54+
runtime: nodejs22.x
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import assert from "node:assert"
2+
import { env } from "node:process"
3+
import { join } from "desm"
4+
import { setup, teardown } from "../../../../_testHelpers/index.js"
5+
import { BASE_URL } from "../../../../config.js"
6+
7+
describe("Node.js 22.x with Docker tests", function desc() {
8+
beforeEach(() =>
9+
setup({
10+
servicePath: join(import.meta.url),
11+
}),
12+
)
13+
14+
afterEach(() => teardown())
15+
;[
16+
{
17+
description: "should work with nodejs22.x in docker container",
18+
expected: {
19+
message: "Hello Node.js 22.x!",
20+
},
21+
path: "/dev/hello",
22+
},
23+
].forEach(({ description, expected, path }) => {
24+
it(description, async function it() {
25+
// "Could not find 'Docker', skipping tests."
26+
if (!env.DOCKER_DETECTED) {
27+
this.skip()
28+
}
29+
30+
const url = new URL(path, BASE_URL)
31+
const response = await fetch(url)
32+
const json = await response.json()
33+
34+
assert.equal(json.message, expected.message)
35+
})
36+
})
37+
})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"use strict"
2+
3+
// eslint-disable-next-line unicorn/prefer-node-protocol
4+
const { versions } = require("process")
5+
6+
const { stringify } = JSON
7+
8+
module.exports.hello = async () => {
9+
return {
10+
body: stringify({
11+
message: "Hello Node.js 22.x!",
12+
version: versions.node,
13+
}),
14+
statusCode: 200,
15+
}
16+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
service: docker-nodejs22-x-test
2+
3+
configValidationMode: error
4+
deprecationNotificationMode: error
5+
6+
plugins:
7+
- ../../../../../src/index.js
8+
9+
provider:
10+
architecture: x86_64
11+
deploymentMethod: direct
12+
memorySize: 1024
13+
name: aws
14+
region: us-east-1
15+
runtime: nodejs22.x
16+
stage: dev
17+
versionFunctions: false
18+
19+
custom:
20+
serverless-offline:
21+
noTimeout: true
22+
useDocker: true
23+
24+
functions:
25+
hello:
26+
events:
27+
- http:
28+
method: get
29+
path: hello
30+
handler: handler.hello

0 commit comments

Comments
 (0)