Skip to content

Commit

Permalink
Update default runtime to Nodejs22.x
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang committed Jan 13, 2025
1 parent a2f967c commit f05b1cc
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 24 deletions.
4 changes: 2 additions & 2 deletions packages/sst/src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ export async function bootstrapSST(cdkBucket: string) {
),
handler: "index.handler",
runtime: region?.startsWith("us-gov-")
? Runtime.NODEJS_20_X
: Runtime.NODEJS_20_X,
? Runtime.NODEJS_22_X
: Runtime.NODEJS_22_X,
environment: {
BUCKET_NAME: bucket.bucketName,
},
Expand Down
6 changes: 3 additions & 3 deletions packages/sst/src/constructs/EdgeFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export class EdgeFunction extends Construct {
const provider = new CdkFunction(stack, providerId, {
code: Code.fromAsset(path.join(__dirname, "../support/edge-function")),
handler: "s3-bucket.handler",
runtime: Runtime.NODEJS_20_X,
runtime: Runtime.NODEJS_22_X,
timeout: CdkDuration.minutes(15),
memorySize: 1024,
initialPolicy: [
Expand Down Expand Up @@ -492,7 +492,7 @@ export class EdgeFunction extends Construct {
provider = new CdkFunction(stack, providerId, {
code: Code.fromAsset(path.join(__dirname, "../support/edge-function")),
handler: "edge-lambda.handler",
runtime: Runtime.NODEJS_20_X,
runtime: Runtime.NODEJS_22_X,
timeout: CdkDuration.minutes(15),
memorySize: 1024,
initialPolicy: [
Expand Down Expand Up @@ -563,7 +563,7 @@ export class EdgeFunction extends Construct {
provider = new CdkFunction(stack, providerId, {
code: Code.fromAsset(path.join(__dirname, "../support/edge-function")),
handler: "edge-lambda-version.handler",
runtime: Runtime.NODEJS_20_X,
runtime: Runtime.NODEJS_22_X,
timeout: CdkDuration.minutes(15),
memorySize: 1024,
initialPolicy: [
Expand Down
2 changes: 1 addition & 1 deletion packages/sst/src/constructs/EventBus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ export class EventBus extends Construct implements SSTConstruct {
});
this.retrierFn = new lambda.Function(this, `RetrierFunction`, {
functionName: app.logicalPrefixedName(this.node.id + "Retrier"),
runtime: lambda.Runtime.NODEJS_20_X,
runtime: lambda.Runtime.NODEJS_22_X,
timeout: Duration.seconds(30),
handler: "index.handler",
code: lambda.Code.fromAsset(
Expand Down
14 changes: 7 additions & 7 deletions packages/sst/src/constructs/Function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ export interface FunctionProps
handler?: string;
/**
* The runtime environment for the function.
* @default "nodejs18.x"
* @default "nodejs22.x"
* @example
* ```js
* new Function(stack, "Function", {
* handler: "function.handler",
* runtime: "nodejs18.x",
* runtime: "nodejs20.x",
* })
*```
*/
Expand Down Expand Up @@ -878,7 +878,7 @@ export class Function extends CDKFunction implements SSTConstruct {
.forEach((per) => {
props = Function.mergeProps(per, props);
});
props.runtime = props.runtime || "nodejs20.x";
props.runtime = props.runtime || "nodejs22.x";
if (props.runtime === "go1.x") useWarning().add("go.deprecated");

// Set defaults
Expand Down Expand Up @@ -920,7 +920,7 @@ export class Function extends CDKFunction implements SSTConstruct {
code: Code.fromInline("export function placeholder() {}"),
handler: "index.placeholder",
functionName,
runtime: CDKRuntime.NODEJS_20_X,
runtime: CDKRuntime.NODEJS_22_X,
memorySize,
ephemeralStorageSize: diskSize,
timeout,
Expand Down Expand Up @@ -974,7 +974,7 @@ export class Function extends CDKFunction implements SSTConstruct {
}
: {
description,
runtime: CDKRuntime.NODEJS_20_X,
runtime: CDKRuntime.NODEJS_22_X,
code: Code.fromAsset(
path.resolve(__dirname, "../support/bridge")
),
Expand Down Expand Up @@ -1022,13 +1022,13 @@ export class Function extends CDKFunction implements SSTConstruct {
? {
code: Code.fromInline("export function placeholder() {}"),
handler: "index.placeholder",
runtime: CDKRuntime.NODEJS_20_X,
runtime: CDKRuntime.NODEJS_22_X,
layers: undefined,
}
: {
code: Code.fromInline("export function placeholder() {}"),
handler: "index.placeholder",
runtime: CDKRuntime.NODEJS_20_X,
runtime: CDKRuntime.NODEJS_22_X,
layers: Function.buildLayers(scope, id, props),
}),
architecture,
Expand Down
10 changes: 8 additions & 2 deletions packages/sst/src/constructs/Job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,13 @@ export interface JobProps {
* })
*```
*/
runtime?: "nodejs" | "nodejs16.x" | "nodejs18.x" | "nodejs20.x" | "nodejs22.x" | "container";
runtime?:
| "nodejs"
| "nodejs16.x"
| "nodejs18.x"
| "nodejs20.x"
| "nodejs22.x"
| "container";
/**
* For "nodejs" runtime, point to the entry point and handler function.
* Of the format: `/path/to/file.function`.
Expand Down Expand Up @@ -694,7 +700,7 @@ export class Job extends Construct implements SSTConstruct {
return new CdkFunction(this, "Manager", {
code: Code.fromAsset(path.join(__dirname, "../support/job-manager/")),
handler: "index.handler",
runtime: Runtime.NODEJS_20_X,
runtime: Runtime.NODEJS_22_X,
timeout: CdkDuration.seconds(10),
memorySize: 1024,
environment: {
Expand Down
6 changes: 3 additions & 3 deletions packages/sst/src/constructs/NextjsSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export class NextjsSite extends SsrSite {
description: "Next.js Image Optimization Function",
handler: imageOpt.handler,
code: Code.fromAsset(path.join(sitePath, imageOpt.bundle)),
runtime: Runtime.NODEJS_20_X,
runtime: Runtime.NODEJS_22_X,
architecture: Architecture.ARM_64,
environment: {
BUCKET_NAME: bucket.bucketName,
Expand Down Expand Up @@ -467,7 +467,7 @@ export class NextjsSite extends SsrSite {
code: Code.fromAsset(
path.join(this.props.path, ".open-next", "revalidation-function")
),
runtime: Runtime.NODEJS_20_X,
runtime: Runtime.NODEJS_22_X,
timeout: CdkDuration.seconds(30),
...cdk?.revalidation,
});
Expand Down Expand Up @@ -524,7 +524,7 @@ export class NextjsSite extends SsrSite {
description: "Next.js revalidation data insert",
handler: "index.handler",
code: Code.fromAsset(dynamodbProviderPath),
runtime: Runtime.NODEJS_20_X,
runtime: Runtime.NODEJS_22_X,
timeout: CdkDuration.minutes(15),
memorySize: Math.min(
10240,
Expand Down
2 changes: 1 addition & 1 deletion packages/sst/src/constructs/RDS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ export class RDS extends Construct implements SSTConstruct {
// Create custom resource handler
const handler = new Function(this, "MigrationHandler", {
code: Code.fromAsset(path.join(__dirname, "../support/script-function")),
runtime: Runtime.NODEJS_20_X,
runtime: Runtime.NODEJS_22_X,
handler: "index.handler",
timeout: CDKDuration.minutes(15),
memorySize: 1024,
Expand Down
2 changes: 1 addition & 1 deletion packages/sst/src/constructs/Script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export class Script extends Construct implements SSTConstruct {
private createCustomResourceFunction(): CdkFunction {
const handler = new CdkFunction(this, "ScriptHandler", {
code: Code.fromAsset(path.join(__dirname, "../support/script-function")),
runtime: Runtime.NODEJS_20_X,
runtime: Runtime.NODEJS_22_X,
handler: "index.handler",
timeout: Duration.minutes(15),
memorySize: 1024,
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 @@ -772,7 +772,7 @@ export abstract class SsrSite extends Construct implements SSTConstruct {
code: Code.fromAsset(
plan.warmer?.function ?? path.join(__dirname, "../support/ssr-warmer")
),
runtime: Runtime.NODEJS_20_X,
runtime: Runtime.NODEJS_22_X,
handler: "index.handler",
timeout: CdkDuration.minutes(15),
memorySize: 128,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class DnsValidatedCertificate
path.join(__dirname, "../../support/certificate-requestor")
),
handler: "index.certificateRequestHandler",
runtime: lambda.Runtime.NODEJS_20_X,
runtime: lambda.Runtime.NODEJS_22_X,
timeout: Duration.minutes(15),
role: props.customResourceRole,
}
Expand Down
4 changes: 2 additions & 2 deletions packages/sst/test/constructs/Function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ test("runtime: container: props", async () => {
{ type: "inline" },
{ type: "local", params: { src: ".", mode: "max" } },
],
cacheTo: { type: "local", params: { dest: ".", mode: "max"} },
cacheTo: { type: "local", params: { dest: ".", mode: "max" } },
},
});
await app.finish();
Expand Down Expand Up @@ -2698,7 +2698,7 @@ test("fromDefinition-lambdaFunction", async () => {
stack,
"Function",
new lambda.Function(stack, "Function", {
runtime: lambda.Runtime.NODEJS_20_X,
runtime: lambda.Runtime.NODEJS_22_X,
handler: "test/lambda.handler",
code: lambda.Code.fromAsset("test"),
}) as Function
Expand Down

0 comments on commit f05b1cc

Please sign in to comment.