Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for nodejs22.x runtime to v13 #1838

Open
wants to merge 1 commit into
base: v13
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/config/supportedRuntimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const supportedRuntimesArchitecture = {
"nodejs16.x": [ARM64, X86_64],
"nodejs18.x": [ARM64, X86_64],
"nodejs20.x": [ARM64, X86_64],
"nodejs22.x": [ARM64, X86_64],
"python3.7": [X86_64],
"python3.8": [ARM64, X86_64],
"python3.9": [ARM64, X86_64],
Expand Down Expand Up @@ -46,6 +47,7 @@ export const supportedNodejs = new Set([
"nodejs16.x",
"nodejs18.x",
"nodejs20.x",
"nodejs22.x",
])

// PROVIDED
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/docker/multiple/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,11 @@ functions:
path: hello3
handler: handler.hello
runtime: python3.8

hello4:
events:
- http:
method: get
path: hello4
handler: handler.hello
runtime: nodejs20.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import assert from "node:assert"
import { env } from "node:process"
import { join } from "desm"
import { setup, teardown } from "../../../../_testHelpers/index.js"
import { BASE_URL } from "../../../../config.js"

describe("Node.js 22.x with Docker tests", function desc() {
beforeEach(() =>
setup({
servicePath: join(import.meta.url),
}),
)

afterEach(() => teardown())
;[
{
description: "should work with nodejs22.x in docker container",
expected: {
message: "Hello Node.js 22.x!",
},
path: "/dev/hello",
},
].forEach(({ description, expected, path }) => {
it(description, async function it() {
// "Could not find 'Docker', skipping tests."
if (!env.DOCKER_DETECTED) {
this.skip()
}

const url = new URL(path, BASE_URL)
const response = await fetch(url)
const json = await response.json()

assert.equal(json.message, expected.message)
})
})
})
16 changes: 16 additions & 0 deletions tests/integration/docker/nodejs/nodejs22.x/handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use strict"

// eslint-disable-next-line unicorn/prefer-node-protocol
const { versions } = require("process")

const { stringify } = JSON

module.exports.hello = async () => {
return {
body: stringify({
message: "Hello Node.js 22.x!",
version: versions.node,
}),
statusCode: 200,
}
}
30 changes: 30 additions & 0 deletions tests/integration/docker/nodejs/nodejs22.x/serverless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
service: docker-nodejs22-x-test

configValidationMode: error
deprecationNotificationMode: error

plugins:
- ../../../../../src/index.js

provider:
architecture: x86_64
deploymentMethod: direct
memorySize: 1024
name: aws
region: us-east-1
runtime: nodejs22.x
stage: dev
versionFunctions: false

custom:
serverless-offline:
noTimeout: true
useDocker: true

functions:
hello:
events:
- http:
method: get
path: hello
handler: handler.hello