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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
"eslint --fix"
]
}
}
}
79 changes: 40 additions & 39 deletions packages/sst/dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"sideEffects": false,
"name": "sst",
"version": "2.40.8",
"version": "2.49.3",
"bin": {
"sst": "cli/sst.js"
},
Expand Down Expand Up @@ -30,39 +31,40 @@
},
"homepage": "https://sst.dev",
"dependencies": {
"@aws-cdk/aws-lambda-python-alpha": "2.132.1-alpha.0",
"@aws-cdk/cloud-assembly-schema": "2.132.1",
"@aws-cdk/cloudformation-diff": "2.132.1",
"@aws-cdk/cx-api": "2.132.1",
"@aws-cdk/aws-lambda-python-alpha": "2.201.0-alpha.0",
"@aws-cdk/cloud-assembly-schema": "44.5.0",
"@aws-cdk/cloudformation-diff": "2.182.0",
"@aws-cdk/cx-api": "2.201.0",
"@aws-cdk/toolkit-lib": "1.1.1",
"@aws-crypto/sha256-js": "^5.2.0",
"@aws-sdk/client-cloudformation": "^3.454.0",
"@aws-sdk/client-ecs": "^3.454.0",
"@aws-sdk/client-eventbridge": "^3.454.0",
"@aws-sdk/client-iam": "^3.454.0",
"@aws-sdk/client-iot": "^3.454.0",
"@aws-sdk/client-iot-data-plane": "^3.454.0",
"@aws-sdk/client-lambda": "^3.454.0",
"@aws-sdk/client-rds-data": "^3.454.0",
"@aws-sdk/client-s3": "^3.454.0",
"@aws-sdk/client-ssm": "^3.454.0",
"@aws-sdk/client-sts": "^3.454.0",
"@aws-sdk/config-resolver": "^3.374.0",
"@aws-sdk/credential-providers": "^3.454.0",
"@aws-sdk/middleware-retry": "^3.374.0",
"@aws-sdk/middleware-signing": "^3.451.0",
"@aws-sdk/signature-v4-crt": "^3.451.0",
"@aws-sdk/smithy-client": "^3.374.0",
"@aws-sdk/client-cloudformation": "3.699.0",
"@aws-sdk/client-ecs": "3.699.0",
"@aws-sdk/client-eventbridge": "3.699.0",
"@aws-sdk/client-iam": "3.699.0",
"@aws-sdk/client-iot": "3.699.0",
"@aws-sdk/client-iot-data-plane": "3.699.0",
"@aws-sdk/client-lambda": "3.699.0",
"@aws-sdk/client-rds-data": "3.699.0",
"@aws-sdk/client-s3": "3.699.0",
"@aws-sdk/client-ssm": "3.699.0",
"@aws-sdk/client-sts": "3.699.0",
"@aws-sdk/config-resolver": "3.374.0",
"@aws-sdk/credential-providers": "3.699.0",
"@aws-sdk/middleware-retry": "3.374.0",
"@aws-sdk/middleware-signing": "3.451.0",
"@aws-sdk/signature-v4-crt": "3.451.0",
"@aws-sdk/smithy-client": "3.374.0",
"@babel/core": "^7.0.0-0",
"@babel/generator": "^7.20.5",
"@babel/plugin-syntax-typescript": "^7.21.4",
"@smithy/signature-v4": "^2.0.16",
"@trpc/server": "9.16.0",
"adm-zip": "^0.5.10",
"aws-cdk-lib": "2.132.1",
"@smithy/signature-v4": "2.0.16",
"@trpc/server": "9.18.0",
"adm-zip": "0.5.14",
"aws-cdk-lib": "2.201.0",
"aws-iot-device-sdk": "^2.2.13",
"aws-sdk": "^2.1501.0",
"builtin-modules": "3.2.0",
"cdk-assets": "2.132.1",
"cdk-assets": "3.3.1",
"chalk": "^5.2.0",
"chokidar": "^3.5.3",
"ci-info": "^3.7.0",
Expand All @@ -74,7 +76,7 @@
"dotenv": "^16.0.3",
"esbuild": "0.18.13",
"express": "^4.18.2",
"fast-jwt": "^3.1.1",
"fast-jwt": "^5.0.5",
"get-port": "^6.1.2",
"glob": "^10.0.0",
"graphql": "*",
Expand All @@ -90,7 +92,6 @@
"ora": "^6.1.2",
"react": "^18.0.0",
"remeda": "^1.3.0",
"sst-aws-cdk": "2.132.1",
"tree-kill": "^1.2.2",
"undici": "^5.12.0",
"uuid": "^9.0.0",
Expand All @@ -99,14 +100,14 @@
"zod": "^3.21.4"
},
"devDependencies": {
"@aws-sdk/client-api-gateway": "^3.454.0",
"@aws-sdk/client-cloudfront": "^3.454.0",
"@aws-sdk/client-codebuild": "^3.454.0",
"@aws-sdk/client-sqs": "^3.454.0",
"@aws-sdk/types": "^3.451.0",
"@aws-sdk/client-api-gateway": "3.699.0",
"@aws-sdk/client-cloudfront": "3.699.0",
"@aws-sdk/client-codebuild": "3.699.0",
"@aws-sdk/client-sqs": "3.699.0",
"@aws-sdk/types": "3.451.0",
"@graphql-tools/merge": "^8.3.16",
"@sls-next/lambda-at-edge": "^3.7.0",
"@smithy/types": "^2.6.0",
"@smithy/types": "4.1.0",
"@tsconfig/node16": "^1.0.3",
"@tsconfig/node18": "^18.2.2",
"@types/adm-zip": "^0.5.0",
Expand All @@ -117,16 +118,16 @@
"@types/babel__generator": "^7.6.4",
"@types/cross-spawn": "^6.0.2",
"@types/express": "^4.17.14",
"@types/node": "^18.11.9",
"@types/node": "18.11.9",
"@types/react": "^18.0.28",
"@types/uuid": "^8.3.4",
"@types/ws": "^8.5.3",
"@types/ws": "8.5.3",
"@types/yargs": "^17.0.13",
"archiver": "^5.3.1",
"astro-sst": "2.40.8",
"astro-sst": "2.45.1",
"async": "^3.2.4",
"tsx": "^3.12.1",
"typescript": "^5.2.2",
"typescript": "5.2.2",
"vitest": "^0.33.0"
},
"peerDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/sst/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@aws-sdk/client-iam": "3.699.0",
"@aws-sdk/client-iot": "3.699.0",
"@aws-sdk/client-iot-data-plane": "3.699.0",
"@aws-sdk/client-lambda": "3.699.0",
"@aws-sdk/client-lambda": "3.956.0",
"@aws-sdk/client-rds-data": "3.699.0",
"@aws-sdk/client-s3": "3.699.0",
"@aws-sdk/client-ssm": "3.699.0",
Expand All @@ -64,7 +64,7 @@
"@smithy/signature-v4": "2.0.16",
"@trpc/server": "9.18.0",
"adm-zip": "0.5.14",
"aws-cdk-lib": "2.201.0",
"aws-cdk-lib": "2.233.0",
"aws-iot-device-sdk": "^2.2.13",
"aws-sdk": "^2.1501.0",
"builtin-modules": "3.2.0",
Expand Down Expand Up @@ -151,4 +151,4 @@
},
"keywords": [],
"author": ""
}
}
23 changes: 11 additions & 12 deletions packages/sst/src/constructs/EdgeFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
export interface EdgeFunctionProps {
bundle?: string;
handler: string;
runtime?: "nodejs16.x" | "nodejs18.x" | "nodejs20.x" | "nodejs22.x";
runtime?: "nodejs16.x" | "nodejs18.x" | "nodejs20.x" | "nodejs22.x" | 'nodejs24.x';
timeout?: number | Duration;
memorySize?: number | Size;
permissions?: Permissions;
Expand Down Expand Up @@ -237,9 +237,8 @@ export class EdgeFunction extends Construct {
// Get handler filename
const isESM = (nodejs?.format || "esm") === "esm";
const parsed = path.parse(result.handler);
const handlerFilename = `${parsed.dir}/${parsed.name}${
isESM ? ".mjs" : ".cjs"
}`;
const handlerFilename = `${parsed.dir}/${parsed.name}${isESM ? ".mjs" : ".cjs"
}`;
return { asset, handlerFilename };
}

Expand Down Expand Up @@ -418,8 +417,7 @@ export class EdgeFunction extends Construct {
ManagedPolicy.fromManagedPolicyArn(
this,
"EdgeLambdaPolicy",
`arn:${
Stack.of(this).partition
`arn:${Stack.of(this).partition
}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole`
),
],
Expand Down Expand Up @@ -508,6 +506,12 @@ export class EdgeFunction extends Construct {
}
}

const runtimeMap: Record<string, string> = {
"nodejs24.x": Runtime.NODEJS_24_X.name,
"nodejs22.x": Runtime.NODEJS_22_X.name,
"nodejs20.x": Runtime.NODEJS_20_X.name,
};

// Create custom resource
const fn = new CustomResource(this.scope, resId, {
serviceToken: provider.functionArn,
Expand All @@ -522,12 +526,7 @@ export class EdgeFunction extends Construct {
S3Bucket: assetBucket,
S3Key: assetKey,
},
Runtime:
runtime === "nodejs22.x"
? Runtime.NODEJS_22_X.name
: runtime === "nodejs20.x"
? Runtime.NODEJS_20_X.name
: Runtime.NODEJS_18_X.name,
Runtime: runtimeMap[runtime] ?? Runtime.NODEJS_18_X.name,
MemorySize:
typeof memorySize === "string"
? toCdkSize(memorySize).toMebibytes()
Expand Down
93 changes: 48 additions & 45 deletions packages/sst/src/constructs/Function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,32 @@ import { useWarning } from "./util/warning.js";
import {
Architecture,
AssetCode,
CfnFunction,
Code,
Function as CDKFunction,
FunctionOptions,
FunctionUrl,
FunctionUrlAuthType,
Handler as CDKHandler,
ILayerVersion,
LayerVersion,
Runtime as CDKRuntime,
Tracing,
InvokeMode,
} from "aws-cdk-lib/aws-lambda";
import type {
CfnFunction,
FunctionOptions,
FunctionUrl,
ILayerVersion,
} from "aws-cdk-lib/aws-lambda";
import { RetentionDays } from "aws-cdk-lib/aws-logs";
import {
Token,
Size as CDKSize,
Duration as CDKDuration,
IgnoreMode,
DockerCacheOption,
CustomResource,
} from "aws-cdk-lib/core";
import { Effect, Policy, PolicyStatement, Role } from "aws-cdk-lib/aws-iam";
import type { DockerCacheOption } from "aws-cdk-lib/core";
import { Effect, Policy, PolicyStatement } from "aws-cdk-lib/aws-iam";
import type { Role } from "aws-cdk-lib/aws-iam";
import { StringParameter } from "aws-cdk-lib/aws-ssm";
import { Platform } from "aws-cdk-lib/aws-ecr-assets";
import { useBootstrap } from "../bootstrap.js";
Expand All @@ -72,6 +75,7 @@ const supportedRuntimes = {
"nodejs18.x": CDKRuntime.NODEJS_18_X,
"nodejs20.x": CDKRuntime.NODEJS_20_X,
"nodejs22.x": CDKRuntime.NODEJS_22_X,
"nodejs24.x": CDKRuntime.NODEJS_24_X,
"python3.7": CDKRuntime.PYTHON_3_7,
"python3.8": CDKRuntime.PYTHON_3_8,
"python3.9": CDKRuntime.PYTHON_3_9,
Expand All @@ -93,8 +97,8 @@ const supportedRuntimes = {
export type Runtime = keyof typeof supportedRuntimes;
export type FunctionInlineDefinition = string | Function;
export type FunctionDefinition = string | Function | FunctionProps;
export interface FunctionUrlCorsProps extends functionUrlCors.CorsProps {}
export interface FunctionDockerBuildCacheProps extends DockerCacheOption {}
export interface FunctionUrlCorsProps extends functionUrlCors.CorsProps { }
export interface FunctionDockerBuildCacheProps extends DockerCacheOption { }

export interface FunctionDockerBuildProps {
/**
Expand Down Expand Up @@ -898,12 +902,12 @@ export class Function extends CDKFunction implements SSTConstruct {
const diskSize = Function.normalizeDiskSize(props.diskSize);
const tracing =
Tracing[
(props.tracing || "active").toUpperCase() as keyof typeof Tracing
(props.tracing || "active").toUpperCase() as keyof typeof Tracing
];
const logRetention =
props.logRetention &&
RetentionDays[
props.logRetention.toUpperCase() as keyof typeof RetentionDays
props.logRetention.toUpperCase() as keyof typeof RetentionDays
];
const isLiveDevEnabled =
app.mode === "dev" && (props.enableLiveDev === false ? false : true);
Expand Down Expand Up @@ -960,28 +964,28 @@ export class Function extends CDKFunction implements SSTConstruct {
...props,
...(props.runtime === "container"
? {
description,
code: Code.fromAssetImage(
path.resolve(__dirname, "../support/bridge"),
{
...(architecture?.dockerPlatform
? { platform: Platform.custom(architecture.dockerPlatform) }
: {}),
}
),
handler: CDKHandler.FROM_IMAGE,
runtime: CDKRuntime.FROM_IMAGE,
layers: undefined,
}
description,
code: Code.fromAssetImage(
path.resolve(__dirname, "../support/bridge"),
{
...(architecture?.dockerPlatform
? { platform: Platform.custom(architecture.dockerPlatform) }
: {}),
}
),
handler: CDKHandler.FROM_IMAGE,
runtime: CDKRuntime.FROM_IMAGE,
layers: undefined,
}
: {
description,
runtime: CDKRuntime.NODEJS_22_X,
code: Code.fromAsset(
path.resolve(__dirname, "../support/bridge")
),
handler: "live-lambda.handler",
layers: [],
}),
description,
runtime: CDKRuntime.NODEJS_22_X,
code: Code.fromAsset(
path.resolve(__dirname, "../support/bridge")
),
handler: "live-lambda.handler",
layers: [],
}),
architecture,
functionName,
memorySize,
Expand All @@ -998,9 +1002,8 @@ export class Function extends CDKFunction implements SSTConstruct {
useDeferredTasks().add(async () => {
if (app.isRunningSSTTest()) return;
const bootstrap = await useBootstrap();
const bootstrapBucketArn = `arn:${Stack.of(this).partition}:s3:::${
bootstrap.bucket
}`;
const bootstrapBucketArn = `arn:${Stack.of(this).partition}:s3:::${bootstrap.bucket
}`;
this.attachPermissions([
new PolicyStatement({
actions: ["iot:*"],
Expand All @@ -1021,17 +1024,17 @@ export class Function extends CDKFunction implements SSTConstruct {
...props,
...(props.runtime === "container"
? {
code: Code.fromInline("export function placeholder() {}"),
handler: "index.placeholder",
runtime: CDKRuntime.NODEJS_22_X,
layers: undefined,
}
code: Code.fromInline("export function placeholder() {}"),
handler: "index.placeholder",
runtime: CDKRuntime.NODEJS_22_X,
layers: undefined,
}
: {
code: Code.fromInline("export function placeholder() {}"),
handler: "index.placeholder",
runtime: CDKRuntime.NODEJS_22_X,
layers: Function.buildLayers(scope, id, props),
}),
code: Code.fromInline("export function placeholder() {}"),
handler: "index.placeholder",
runtime: CDKRuntime.NODEJS_22_X,
layers: Function.buildLayers(scope, id, props),
}),
architecture,
functionName,
memorySize,
Expand Down Expand Up @@ -1465,7 +1468,7 @@ export class Function extends CDKFunction implements SSTConstruct {
if (inheritedProps && Object.keys(inheritedProps).length > 0) {
throw new Error(
inheritErrorMessage ||
`Cannot inherit default props when a Function is provided`
`Cannot inherit default props when a Function is provided`
);
}
return definition;
Expand Down
Loading