sst 2.45.1 → 2.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bootstrap.js CHANGED
@@ -206,8 +206,8 @@ export async function bootstrapSST(cdkBucket) {
206
206
  code: Code.fromAsset(path.resolve(__dirname, "support/bootstrap-metadata-function")),
207
207
  handler: "index.handler",
208
208
  runtime: region?.startsWith("us-gov-")
209
- ? Runtime.NODEJS_18_X
210
- : Runtime.NODEJS_18_X,
209
+ ? Runtime.NODEJS_22_X
210
+ : Runtime.NODEJS_22_X,
211
211
  environment: {
212
212
  BUCKET_NAME: bucket.bucketName,
213
213
  },
@@ -1,5 +1,5 @@
1
1
  const FIELDS = ["dependencies", "devDependencies"];
2
- const SST_PKGS = ["sst", "astro-sst", "svelte-kit-sst", "solid-start-sst"];
2
+ const SST_PKGS = ["sst", "svelte-kit-sst", "solid-start-sst"];
3
3
  export const update = (program) => program.command("update [version]", "Update your SST and CDK packages", (yargs) => yargs.positional("version", {
4
4
  type: "string",
5
5
  describe: "Optionally specify a version to update to",
@@ -283,7 +283,7 @@ export class EdgeFunction extends Construct {
283
283
  const provider = new CdkFunction(stack, providerId, {
284
284
  code: Code.fromAsset(path.join(__dirname, "../support/edge-function")),
285
285
  handler: "s3-bucket.handler",
286
- runtime: Runtime.NODEJS_18_X,
286
+ runtime: Runtime.NODEJS_22_X,
287
287
  timeout: CdkDuration.minutes(15),
288
288
  memorySize: 1024,
289
289
  initialPolicy: [
@@ -316,7 +316,7 @@ export class EdgeFunction extends Construct {
316
316
  provider = new CdkFunction(stack, providerId, {
317
317
  code: Code.fromAsset(path.join(__dirname, "../support/edge-function")),
318
318
  handler: "edge-lambda.handler",
319
- runtime: Runtime.NODEJS_18_X,
319
+ runtime: Runtime.NODEJS_22_X,
320
320
  timeout: CdkDuration.minutes(15),
321
321
  memorySize: 1024,
322
322
  initialPolicy: [
@@ -349,9 +349,7 @@ export class EdgeFunction extends Construct {
349
349
  ? Runtime.NODEJS_22_X.name
350
350
  : runtime === "nodejs20.x"
351
351
  ? Runtime.NODEJS_20_X.name
352
- : runtime === "nodejs16.x"
353
- ? Runtime.NODEJS_16_X.name
354
- : Runtime.NODEJS_18_X.name,
352
+ : Runtime.NODEJS_18_X.name,
355
353
  MemorySize: typeof memorySize === "string"
356
354
  ? toCdkSize(memorySize).toMebibytes()
357
355
  : memorySize,
@@ -382,7 +380,7 @@ export class EdgeFunction extends Construct {
382
380
  provider = new CdkFunction(stack, providerId, {
383
381
  code: Code.fromAsset(path.join(__dirname, "../support/edge-function")),
384
382
  handler: "edge-lambda-version.handler",
385
- runtime: Runtime.NODEJS_18_X,
383
+ runtime: Runtime.NODEJS_22_X,
386
384
  timeout: CdkDuration.minutes(15),
387
385
  memorySize: 1024,
388
386
  initialPolicy: [
@@ -248,7 +248,7 @@ export class EventBus extends Construct {
248
248
  });
249
249
  this.retrierFn = new lambda.Function(this, `RetrierFunction`, {
250
250
  functionName: app.logicalPrefixedName(this.node.id + "Retrier"),
251
- runtime: lambda.Runtime.NODEJS_18_X,
251
+ runtime: lambda.Runtime.NODEJS_22_X,
252
252
  timeout: Duration.seconds(30),
253
253
  handler: "index.handler",
254
254
  code: lambda.Code.fromAsset(path.join(__dirname, "../support/event-bus-retrier")),
@@ -148,12 +148,12 @@ export interface FunctionProps extends Omit<FunctionOptions, "functionName" | "m
148
148
  handler?: string;
149
149
  /**
150
150
  * The runtime environment for the function.
151
- * @default "nodejs18.x"
151
+ * @default "nodejs22.x"
152
152
  * @example
153
153
  * ```js
154
154
  * new Function(stack, "Function", {
155
155
  * handler: "function.handler",
156
- * runtime: "nodejs18.x",
156
+ * runtime: "nodejs20.x",
157
157
  * })
158
158
  *```
159
159
  */
@@ -88,7 +88,7 @@ export class Function extends CDKFunction {
88
88
  .forEach((per) => {
89
89
  props = Function.mergeProps(per, props);
90
90
  });
91
- props.runtime = props.runtime || "nodejs18.x";
91
+ props.runtime = props.runtime || "nodejs22.x";
92
92
  if (props.runtime === "go1.x")
93
93
  useWarning().add("go.deprecated");
94
94
  // Set defaults
@@ -122,7 +122,7 @@ export class Function extends CDKFunction {
122
122
  code: Code.fromInline("export function placeholder() {}"),
123
123
  handler: "index.placeholder",
124
124
  functionName,
125
- runtime: CDKRuntime.NODEJS_18_X,
125
+ runtime: CDKRuntime.NODEJS_22_X,
126
126
  memorySize,
127
127
  ephemeralStorageSize: diskSize,
128
128
  timeout,
@@ -171,7 +171,7 @@ export class Function extends CDKFunction {
171
171
  }
172
172
  : {
173
173
  description,
174
- runtime: CDKRuntime.NODEJS_18_X,
174
+ runtime: CDKRuntime.NODEJS_22_X,
175
175
  code: Code.fromAsset(path.resolve(__dirname, "../support/bridge")),
176
176
  handler: "live-lambda.handler",
177
177
  layers: [],
@@ -216,13 +216,13 @@ export class Function extends CDKFunction {
216
216
  ? {
217
217
  code: Code.fromInline("export function placeholder() {}"),
218
218
  handler: "index.placeholder",
219
- runtime: CDKRuntime.NODEJS_18_X,
219
+ runtime: CDKRuntime.NODEJS_22_X,
220
220
  layers: undefined,
221
221
  }
222
222
  : {
223
223
  code: Code.fromInline("export function placeholder() {}"),
224
224
  handler: "index.placeholder",
225
- runtime: CDKRuntime.NODEJS_18_X,
225
+ runtime: CDKRuntime.NODEJS_22_X,
226
226
  layers: Function.buildLayers(scope, id, props),
227
227
  }),
228
228
  architecture,
package/constructs/Job.js CHANGED
@@ -329,7 +329,7 @@ export class Job extends Construct {
329
329
  return new CdkFunction(this, "Manager", {
330
330
  code: Code.fromAsset(path.join(__dirname, "../support/job-manager/")),
331
331
  handler: "index.handler",
332
- runtime: Runtime.NODEJS_18_X,
332
+ runtime: Runtime.NODEJS_22_X,
333
333
  timeout: CdkDuration.seconds(10),
334
334
  memorySize: 1024,
335
335
  environment: {
@@ -156,7 +156,7 @@ export class NextjsSite extends SsrSite {
156
156
  description: "Next.js Image Optimization Function",
157
157
  handler: imageOpt.handler,
158
158
  code: Code.fromAsset(path.join(sitePath, imageOpt.bundle)),
159
- runtime: Runtime.NODEJS_18_X,
159
+ runtime: Runtime.NODEJS_22_X,
160
160
  architecture: Architecture.ARM_64,
161
161
  environment: {
162
162
  BUCKET_NAME: bucket.bucketName,
@@ -230,7 +230,7 @@ export class NextjsSite extends SsrSite {
230
230
  description: "Next.js revalidator",
231
231
  handler: "index.handler",
232
232
  code: Code.fromAsset(path.join(this.props.path, ".open-next", "revalidation-function")),
233
- runtime: Runtime.NODEJS_18_X,
233
+ runtime: Runtime.NODEJS_22_X,
234
234
  timeout: CdkDuration.seconds(30),
235
235
  ...cdk?.revalidation,
236
236
  });
@@ -274,7 +274,7 @@ export class NextjsSite extends SsrSite {
274
274
  description: "Next.js revalidation data insert",
275
275
  handler: "index.handler",
276
276
  code: Code.fromAsset(dynamodbProviderPath),
277
- runtime: Runtime.NODEJS_18_X,
277
+ runtime: Runtime.NODEJS_22_X,
278
278
  timeout: CdkDuration.minutes(15),
279
279
  memorySize: Math.min(10240, Math.max(128, Math.ceil(prerenderedRouteCount / 4000) * 128)),
280
280
  initialPolicy: [
package/constructs/RDS.js CHANGED
@@ -343,7 +343,7 @@ export class RDS extends Construct {
343
343
  // Create custom resource handler
344
344
  const handler = new Function(this, "MigrationHandler", {
345
345
  code: Code.fromAsset(path.join(__dirname, "../support/script-function")),
346
- runtime: Runtime.NODEJS_18_X,
346
+ runtime: Runtime.NODEJS_22_X,
347
347
  handler: "index.handler",
348
348
  timeout: CDKDuration.minutes(15),
349
349
  memorySize: 1024,
@@ -121,7 +121,7 @@ export class Script extends Construct {
121
121
  createCustomResourceFunction() {
122
122
  const handler = new CdkFunction(this, "ScriptHandler", {
123
123
  code: Code.fromAsset(path.join(__dirname, "../support/script-function")),
124
- runtime: Runtime.NODEJS_18_X,
124
+ runtime: Runtime.NODEJS_22_X,
125
125
  handler: "index.handler",
126
126
  timeout: Duration.minutes(15),
127
127
  memorySize: 1024,
@@ -6,7 +6,7 @@ import { SSTConstruct } from "./Construct.js";
6
6
  import { Permissions } from "./util/permission.js";
7
7
  import { BindingProps, BindingResource } from "./util/binding.js";
8
8
  import { IVpc } from "aws-cdk-lib/aws-ec2";
9
- import { ContainerDefinitionOptions, CpuArchitecture, FargateService, FargateTaskDefinition, FargateServiceProps, ICluster } from "aws-cdk-lib/aws-ecs";
9
+ import { ContainerDefinitionOptions, CpuArchitecture, FargateService, FargateTaskDefinition, FargateServiceProps, ICluster, ScalableTaskCount } from "aws-cdk-lib/aws-ecs";
10
10
  import { RetentionDays } from "aws-cdk-lib/aws-logs";
11
11
  import { ApplicationLoadBalancer, ApplicationLoadBalancerProps, ApplicationTargetGroupProps, BaseApplicationListenerProps } from "aws-cdk-lib/aws-elasticloadbalancingv2";
12
12
  declare const supportedCpus: {
@@ -119,7 +119,7 @@ export interface ServiceProps {
119
119
  */
120
120
  maxContainers?: number;
121
121
  /**
122
- * Scales in or out to achieve a target cpu utilization.
122
+ * Scales in or out to achieve a target cpu utilization. Set to `false` to disable.
123
123
  * @default 70
124
124
  * @example
125
125
  * ```js
@@ -131,9 +131,9 @@ export interface ServiceProps {
131
131
  * }
132
132
  *```
133
133
  */
134
- cpuUtilization?: number;
134
+ cpuUtilization?: number | false;
135
135
  /**
136
- * Scales in or out to achieve a target memory utilization.
136
+ * Scales in or out to achieve a target memory utilization. Set to `false` to disable.
137
137
  * @default 70
138
138
  * @example
139
139
  * ```js
@@ -145,9 +145,9 @@ export interface ServiceProps {
145
145
  * }
146
146
  *```
147
147
  */
148
- memoryUtilization?: number;
148
+ memoryUtilization?: number | false;
149
149
  /**
150
- * Scales in or out to achieve a target request count per container.
150
+ * Scales in or out to achieve a target request count per container. Set to `false` to disable.
151
151
  * @default 500
152
152
  * @example
153
153
  * ```js
@@ -158,7 +158,7 @@ export interface ServiceProps {
158
158
  * }
159
159
  *```
160
160
  */
161
- requestsPerContainer?: number;
161
+ requestsPerContainer?: number | false;
162
162
  };
163
163
  /**
164
164
  * Bind resources for the function
@@ -491,6 +491,7 @@ export declare class Service extends Construct implements SSTConstruct {
491
491
  private service?;
492
492
  private distribution?;
493
493
  private alb?;
494
+ private scaling?;
494
495
  constructor(scope: Construct, id: string, props: ServiceProps);
495
496
  /**
496
497
  * The CloudFront URL of the website.
@@ -513,6 +514,7 @@ export declare class Service extends Construct implements SSTConstruct {
513
514
  applicationLoadBalancer: ApplicationLoadBalancer | undefined;
514
515
  hostedZone: import("aws-cdk-lib/aws-route53").IHostedZone | undefined;
515
516
  certificate: import("aws-cdk-lib/aws-certificatemanager").ICertificate | undefined;
517
+ scaling: ScalableTaskCount | undefined;
516
518
  } | undefined;
517
519
  getConstructMetadata(): {
518
520
  type: "Service";
@@ -149,6 +149,7 @@ export class Service extends Construct {
149
149
  service;
150
150
  distribution;
151
151
  alb;
152
+ scaling;
152
153
  constructor(scope, id, props) {
153
154
  super(scope, id);
154
155
  const app = scope.node.root;
@@ -178,7 +179,7 @@ export class Service extends Construct {
178
179
  const cluster = this.createCluster(vpc);
179
180
  const { container, taskDefinition, service } = this.createService(cluster);
180
181
  const { alb, target } = this.createLoadBalancer(vpc, service);
181
- this.createAutoScaling(service, target);
182
+ const scaling = this.createAutoScaling(service, target);
182
183
  this.alb = alb;
183
184
  // Create Distribution
184
185
  this.distribution = this.createDistribution(alb);
@@ -187,6 +188,7 @@ export class Service extends Construct {
187
188
  this.service = service;
188
189
  this.container = container;
189
190
  this.taskDefinition = taskDefinition;
191
+ this.scaling = scaling;
190
192
  this.bindForService(props?.bind || []);
191
193
  this.attachPermissionsForService(props?.permissions || []);
192
194
  Object.entries(props?.environment || {}).map(([key, value]) => this.addEnvironmentForService(key, value));
@@ -253,6 +255,7 @@ export class Service extends Construct {
253
255
  applicationLoadBalancer: this.alb,
254
256
  hostedZone: this.distribution?.cdk.hostedZone,
255
257
  certificate: this.distribution?.cdk.certificate,
258
+ scaling: this.scaling,
256
259
  };
257
260
  }
258
261
  /////////////////////
@@ -490,20 +493,25 @@ export class Service extends Construct {
490
493
  minCapacity: minContainers ?? 1,
491
494
  maxCapacity: maxContainers ?? 1,
492
495
  });
493
- scaling.scaleOnCpuUtilization("CpuScaling", {
494
- targetUtilizationPercent: cpuUtilization ?? 70,
495
- scaleOutCooldown: CdkDuration.seconds(300),
496
- });
497
- scaling.scaleOnMemoryUtilization("MemoryScaling", {
498
- targetUtilizationPercent: memoryUtilization ?? 70,
499
- scaleOutCooldown: CdkDuration.seconds(300),
500
- });
501
- if (target) {
496
+ if (cpuUtilization !== false) {
497
+ scaling.scaleOnCpuUtilization("CpuScaling", {
498
+ targetUtilizationPercent: cpuUtilization ?? 70,
499
+ scaleOutCooldown: CdkDuration.seconds(300),
500
+ });
501
+ }
502
+ if (memoryUtilization !== false) {
503
+ scaling.scaleOnMemoryUtilization("MemoryScaling", {
504
+ targetUtilizationPercent: memoryUtilization ?? 70,
505
+ scaleOutCooldown: CdkDuration.seconds(300),
506
+ });
507
+ }
508
+ if (target && requestsPerContainer !== false) {
502
509
  scaling.scaleOnRequestCount("RequestScaling", {
503
510
  requestsPerTarget: requestsPerContainer ?? 500,
504
511
  targetGroup: target,
505
512
  });
506
513
  }
514
+ return scaling;
507
515
  }
508
516
  createDistribution(alb) {
509
517
  const { cdk, customDomain } = this.props;
@@ -111,9 +111,7 @@ export class SsrFunction extends Construct {
111
111
  ? Runtime.NODEJS_22_X
112
112
  : runtime === "nodejs20.x"
113
113
  ? Runtime.NODEJS_20_X
114
- : runtime === "nodejs16.x"
115
- ? Runtime.NODEJS_16_X
116
- : Runtime.NODEJS_18_X,
114
+ : Runtime.NODEJS_18_X,
117
115
  architecture,
118
116
  memorySize: typeof memorySize === "string"
119
117
  ? toCdkSize(memorySize).toMebibytes()
@@ -229,7 +229,7 @@ export class SsrSite extends Construct {
229
229
  const warmer = new CdkFunction(self, "WarmerFunction", {
230
230
  description: "SSR warmer",
231
231
  code: Code.fromAsset(plan.warmer?.function ?? path.join(__dirname, "../support/ssr-warmer")),
232
- runtime: Runtime.NODEJS_18_X,
232
+ runtime: Runtime.NODEJS_22_X,
233
233
  handler: "index.handler",
234
234
  timeout: CdkDuration.minutes(15),
235
235
  memorySize: 128,
@@ -196,7 +196,7 @@ export class Stack extends CDKStack {
196
196
  assetHash: this.stackName + fs.readFileSync(dir + "/index.mjs").toString(),
197
197
  }),
198
198
  handler: "index.handler",
199
- runtime: lambda.Runtime.NODEJS_18_X,
199
+ runtime: lambda.Runtime.NODEJS_20_X,
200
200
  timeout: CDKDuration.seconds(900),
201
201
  memorySize: 1024,
202
202
  });
@@ -47,7 +47,7 @@ export class DnsValidatedCertificate extends CertificateBase {
47
47
  const requestorFunction = new lambda.Function(this, "CertificateRequestorFunction", {
48
48
  code: lambda.Code.fromAsset(path.join(__dirname, "../../support/certificate-requestor")),
49
49
  handler: "index.certificateRequestHandler",
50
- runtime: lambda.Runtime.NODEJS_18_X,
50
+ runtime: lambda.Runtime.NODEJS_22_X,
51
51
  timeout: Duration.minutes(15),
52
52
  role: props.customResourceRole,
53
53
  });
@@ -1045,9 +1045,6 @@ export class NextjsSite extends Construct {
1045
1045
  if (runtime === "nodejs20.x") {
1046
1046
  return lambda.Runtime.NODEJS_20_X;
1047
1047
  }
1048
- if (runtime === "nodejs16.x") {
1049
- return lambda.Runtime.NODEJS_16_X;
1050
- }
1051
1048
  return lambda.Runtime.NODEJS_18_X;
1052
1049
  }
1053
1050
  }
@@ -18,7 +18,7 @@ export function getOrCreateBucket(scope) {
18
18
  const provider = new lambda.Function(stack, providerId, {
19
19
  code: lambda.Code.fromAsset(path.join(__dirname, "../../support/edge-function")),
20
20
  handler: "s3-bucket.handler",
21
- runtime: lambda.Runtime.NODEJS_18_X,
21
+ runtime: lambda.Runtime.NODEJS_20_X,
22
22
  timeout: Duration.minutes(15),
23
23
  memorySize: 1024,
24
24
  initialPolicy: [
@@ -50,7 +50,7 @@ export function createFunction(scope, name, role, bucketName, functionParams) {
50
50
  provider = new lambda.Function(stack, providerId, {
51
51
  code: lambda.Code.fromAsset(path.join(__dirname, "../../support/edge-function")),
52
52
  handler: "edge-lambda.handler",
53
- runtime: lambda.Runtime.NODEJS_18_X,
53
+ runtime: lambda.Runtime.NODEJS_20_X,
54
54
  timeout: Duration.minutes(15),
55
55
  memorySize: 1024,
56
56
  initialPolicy: [
@@ -88,7 +88,7 @@ export function createVersion(scope, name, functionArn) {
88
88
  provider = new lambda.Function(stack, providerId, {
89
89
  code: lambda.Code.fromAsset(path.join(__dirname, "../../support/edge-function")),
90
90
  handler: "edge-lambda-version.handler",
91
- runtime: lambda.Runtime.NODEJS_18_X,
91
+ runtime: lambda.Runtime.NODEJS_20_X,
92
92
  timeout: Duration.minutes(15),
93
93
  memorySize: 1024,
94
94
  initialPolicy: [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.45.1",
4
+ "version": "2.47.0",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
@@ -101,7 +101,7 @@
101
101
  "@aws-sdk/types": "^3.451.0",
102
102
  "@graphql-tools/merge": "^8.3.16",
103
103
  "@sls-next/lambda-at-edge": "^3.7.0",
104
- "@smithy/types": "^2.6.0",
104
+ "@smithy/types": "4.1.0",
105
105
  "@tsconfig/node16": "^1.0.3",
106
106
  "@tsconfig/node18": "^18.2.2",
107
107
  "@types/adm-zip": "^0.5.0",