Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/default-nodejs24.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"sst": patch
---

Change the default Lambda runtime to `nodejs24.x` for all function-based constructs.
2 changes: 1 addition & 1 deletion packages/sst/src/constructs/EdgeFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class EdgeFunction extends Construct {
this.scope = props.scopeOverride || this;

this.props = {
runtime: "nodejs18.x",
runtime: "nodejs24.x",
timeout: 10,
memorySize: 1024,
...props,
Expand Down
4 changes: 2 additions & 2 deletions packages/sst/src/constructs/Function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export interface FunctionProps
handler?: string;
/**
* The runtime environment for the function.
* @default "nodejs22.x"
* @default "nodejs24.x"
* @example
* ```js
* new Function(stack, "Function", {
Expand Down Expand Up @@ -880,7 +880,7 @@ export class Function extends CDKFunction implements SSTConstruct {
.forEach((per) => {
props = Function.mergeProps(per, props);
});
props.runtime = props.runtime || "nodejs22.x";
props.runtime = props.runtime || "nodejs24.x";
if (props.runtime === "go1.x") useWarning().add("go.deprecated");

// Set defaults
Expand Down
6 changes: 3 additions & 3 deletions packages/sst/src/constructs/Job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export interface JobProps {
architecture?: "x86_64" | "arm_64";
/**
* The runtime environment for the job.
* @default "nodejs18.x"
* @default "nodejs24.x"
* @example
* ```js
* new Job(stack, "MyJob", {
Expand Down Expand Up @@ -665,7 +665,7 @@ export class Job extends Construct implements SSTConstruct {
};
const image = LinuxBuildImage.fromDockerRegistry(
// ARM images can be found here https://hub.docker.com/r/amazon/aws-lambda-nodejs
dockerImageMap[architecture ?? "x86_64"][runtime ?? "nodejs18.x"]
dockerImageMap[architecture ?? "x86_64"][runtime ?? "nodejs24.x"]
);
project.environment = {
...project.environment,
Expand Down Expand Up @@ -804,6 +804,6 @@ export class Job extends Construct implements SSTConstruct {

private convertJobRuntimeToFunctionRuntime() {
const { runtime } = this.props;
return runtime === "container" ? "container" : "nodejs18.x";
return runtime === "container" ? "container" : "nodejs24.x";
}
}
4 changes: 2 additions & 2 deletions packages/sst/src/constructs/NextjsSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export class NextjsSite extends SsrSite {
...baseServerConfig,
handler: fn.handler,
bundle: path.join(sitePath, fn.bundle),
runtime: this.props.runtime ?? ("nodejs18.x" as const),
runtime: this.props.runtime ?? ("nodejs24.x" as const),
architecture: Architecture.ARM_64,
memorySize: this.props.memorySize ?? 1536,
environment: {
Expand Down Expand Up @@ -311,7 +311,7 @@ export class NextjsSite extends SsrSite {
function: {
handler: fn.handler,
bundle: path.join(sitePath, fn.bundle),
runtime: "nodejs18.x" as const,
runtime: "nodejs24.x" as const,
memorySize: 1024,
environment: {
...environment,
Expand Down
2 changes: 1 addition & 1 deletion packages/sst/src/constructs/SsrSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ function handler(event) {
singletonUrlSigner ??
new EdgeFunction(self, "ServerUrlSigningFunction", {
bundle: path.join(__dirname, "../support/signing-function"),
runtime: "nodejs18.x",
runtime: "nodejs24.x",
handler: "index.handler",
timeout: 10,
memorySize: 128,
Expand Down
2 changes: 1 addition & 1 deletion packages/sst/src/constructs/Stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class Stack extends CDKStack {
* ```js
* stack.setDefaultFunctionProps({
* srcPath: "backend",
* runtime: "nodejs18.x",
* runtime: "nodejs24.x",
* });
* ```
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/sst/src/constructs/deprecated/NextjsSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ export interface NextjsSiteProps {
permissions?: Permissions;
/**
* The runtime environment.
* @default "nodejs18.x"
* @default "nodejs24.x"
* @example
* ```js
* new Function(stack, "Function", {
* path: "path/to/site",
* runtime: "nodejs18.x",
* runtime: "nodejs24.x",
* })
*```
*/
Expand Down Expand Up @@ -1504,7 +1504,7 @@ export class NextjsSite extends Construct implements SSTConstruct {
if (runtime === "nodejs20.x") {
return lambda.Runtime.NODEJS_20_X;
}
return lambda.Runtime.NODEJS_18_X;
return lambda.Runtime.NODEJS_24_X;
}
}

Expand Down
12 changes: 12 additions & 0 deletions packages/sst/test/constructs/Function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ test("constructor: props with minimum config", async () => {
countResources(stack, "AWS::Lambda::EventInvokeConfig", 0);
});

test("constructor: default runtime", async () => {
const app = await createApp();
const stack = new Stack(app, "stack");
new Function(stack, "Function", {
handler: "test/constructs/lambda.handler",
});
await app.finish();
hasResource(stack, "AWS::Lambda::Function", {
Runtime: "nodejs24.x",
});
});

test("constructor: props with full config", async () => {
const stack = new Stack(await createApp(), "stack");
new Function(stack, "Function", {
Expand Down
2 changes: 1 addition & 1 deletion packages/sst/test/constructs/Job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test("constructor: default", async () => {
Value: "/test/test/",
}),
],
Image: "amazon/aws-lambda-nodejs:18",
Image: "amazon/aws-lambda-nodejs:24",
Type: "LINUX_CONTAINER",
},
TimeoutInMinutes: 480,
Expand Down
Loading