sst 2.36.0 → 2.36.2

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
@@ -203,7 +203,7 @@ export async function bootstrapSST(cdkBucket) {
203
203
  code: Code.fromAsset(path.resolve(__dirname, "support/bootstrap-metadata-function")),
204
204
  handler: "index.handler",
205
205
  runtime: region?.startsWith("us-gov-")
206
- ? Runtime.NODEJS_16_X
206
+ ? Runtime.NODEJS_18_X
207
207
  : Runtime.NODEJS_18_X,
208
208
  environment: {
209
209
  BUCKET_NAME: bucket.bucketName,
@@ -123,6 +123,7 @@ export async function useLocalServer(opts) {
123
123
  properties: {
124
124
  app: project.config.name,
125
125
  stage: project.config.stage,
126
+ region: project.config.region,
126
127
  },
127
128
  }));
128
129
  for (const invocation of invocations) {
@@ -110,7 +110,7 @@ export declare class App extends CDKApp {
110
110
  * @example
111
111
  * ```js
112
112
  * app.setDefaultFunctionProps({
113
- * runtime: "nodejs16.x",
113
+ * runtime: "nodejs18.x",
114
114
  * timeout: 30
115
115
  * })
116
116
  * ```
package/constructs/App.js CHANGED
@@ -117,7 +117,7 @@ export class App extends CDKApp {
117
117
  * @example
118
118
  * ```js
119
119
  * app.setDefaultFunctionProps({
120
- * runtime: "nodejs16.x",
120
+ * runtime: "nodejs18.x",
121
121
  * timeout: 30
122
122
  * })
123
123
  * ```
@@ -241,14 +241,17 @@ export class App extends CDKApp {
241
241
  this.isFinished = true;
242
242
  const { config, paths } = useProject();
243
243
  Auth.injectConfig();
244
- this.buildConstructsMetadata();
245
244
  this.ensureUniqueConstructIds();
246
245
  // Run deferred tasks
247
- // - after codegen b/c some frontend frameworks (ie. Next.js apps) runs
246
+ // - After codegen b/c some frontend frameworks (ie. Next.js apps) runs
248
247
  // type checking in the build step
249
- // - before remove govcloud unsupported resource properties b/c deferred
248
+ // - Before remove govcloud unsupported resource properties b/c deferred
250
249
  // tasks may add govcloud unsupported resource properties
251
250
  await useDeferredTasks().run();
251
+ // Build constructs metadata after running deferred tasks
252
+ // - Metadata for Functions needs to know if sourcemaps are enabled, which
253
+ // is not known until after build
254
+ this.buildConstructsMetadata();
252
255
  this.createBindingSsmParameters();
253
256
  this.removeGovCloudUnsupportedResourceProperties();
254
257
  useWarning().print();
@@ -270,7 +273,7 @@ export class App extends CDKApp {
270
273
  effect: Effect.ALLOW,
271
274
  actions: ["s3:GetObject", "s3:PutObject"],
272
275
  resources: [
273
- sourcemaps[0].srcBucket.bucketArn + "/*",
276
+ sourcemaps[0].asset.bucket.bucketArn + "/*",
274
277
  `arn:${child.partition}:s3:::${bootstrap.bucket}/*`,
275
278
  ],
276
279
  }),
@@ -284,8 +287,11 @@ export class App extends CDKApp {
284
287
  app: this.name,
285
288
  stage: this.stage,
286
289
  tarBucket: bootstrap.bucket,
287
- srcBucket: sourcemaps[0].srcBucket.bucketName,
288
- sourcemaps: sourcemaps.map((s) => [s.tarKey, s.srcKey]),
290
+ srcBucket: sourcemaps[0].asset.bucket.bucketName,
291
+ sourcemaps: sourcemaps.map((s) => [
292
+ s.tarKey,
293
+ s.asset.s3ObjectKey,
294
+ ]),
289
295
  },
290
296
  });
291
297
  resource.node.addDependency(policy);
@@ -70,7 +70,7 @@ export declare class AstroSite extends SsrSite {
70
70
  data: {
71
71
  mode: "placeholder" | "deployed";
72
72
  path: string;
73
- runtime: "nodejs14.x" | "nodejs16.x" | "nodejs18.x";
73
+ runtime: "nodejs16.x" | "nodejs18.x";
74
74
  customDomainUrl: string | undefined;
75
75
  url: string | undefined;
76
76
  edge: boolean | undefined;
@@ -9,7 +9,7 @@ import { Permissions } from "./util/permission.js";
9
9
  export interface EdgeFunctionProps {
10
10
  bundle?: string;
11
11
  handler: string;
12
- runtime?: "nodejs14.x" | "nodejs16.x" | "nodejs18.x";
12
+ runtime?: "nodejs16.x" | "nodejs18.x";
13
13
  timeout?: number | Duration;
14
14
  memorySize?: number | Size;
15
15
  permissions?: Permissions;
@@ -125,8 +125,7 @@ export class EdgeFunction extends Construct {
125
125
  });
126
126
  await fs.promises.rm(result.sourcemap);
127
127
  useFunctions().sourcemaps.add(stack.stackName, {
128
- srcBucket: asset.bucket,
129
- srcKey: asset.s3ObjectKey,
128
+ asset,
130
129
  tarKey: this.functionArn,
131
130
  });
132
131
  }
@@ -285,7 +284,7 @@ export class EdgeFunction extends Construct {
285
284
  const provider = new CdkFunction(stack, providerId, {
286
285
  code: Code.fromAsset(path.join(__dirname, "../support/edge-function")),
287
286
  handler: "s3-bucket.handler",
288
- runtime: Runtime.NODEJS_16_X,
287
+ runtime: Runtime.NODEJS_18_X,
289
288
  timeout: CdkDuration.minutes(15),
290
289
  memorySize: 1024,
291
290
  initialPolicy: [
@@ -318,7 +317,7 @@ export class EdgeFunction extends Construct {
318
317
  provider = new CdkFunction(stack, providerId, {
319
318
  code: Code.fromAsset(path.join(__dirname, "../support/edge-function")),
320
319
  handler: "edge-lambda.handler",
321
- runtime: Runtime.NODEJS_16_X,
320
+ runtime: Runtime.NODEJS_18_X,
322
321
  timeout: CdkDuration.minutes(15),
323
322
  memorySize: 1024,
324
323
  initialPolicy: [
@@ -347,11 +346,9 @@ export class EdgeFunction extends Construct {
347
346
  S3Bucket: assetBucket,
348
347
  S3Key: assetKey,
349
348
  },
350
- Runtime: runtime === "nodejs14.x"
351
- ? Runtime.NODEJS_14_X.name
352
- : runtime === "nodejs16.x"
353
- ? Runtime.NODEJS_16_X.name
354
- : Runtime.NODEJS_18_X.name,
349
+ Runtime: runtime === "nodejs16.x"
350
+ ? Runtime.NODEJS_16_X.name
351
+ : Runtime.NODEJS_18_X.name,
355
352
  MemorySize: typeof memorySize === "string"
356
353
  ? toCdkSize(memorySize).toMebibytes()
357
354
  : memorySize,
@@ -382,7 +379,7 @@ export class EdgeFunction extends Construct {
382
379
  provider = new CdkFunction(stack, providerId, {
383
380
  code: Code.fromAsset(path.join(__dirname, "../support/edge-function")),
384
381
  handler: "edge-lambda-version.handler",
385
- runtime: Runtime.NODEJS_16_X,
382
+ runtime: Runtime.NODEJS_18_X,
386
383
  timeout: CdkDuration.minutes(15),
387
384
  memorySize: 1024,
388
385
  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_16_X,
251
+ runtime: lambda.Runtime.NODEJS_18_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")),
@@ -10,11 +10,10 @@ import * as functionUrlCors from "./util/functionUrlCors.js";
10
10
  import { Architecture, Function as CDKFunction, FunctionOptions, ILayerVersion, Runtime as CDKRuntime, Tracing } from "aws-cdk-lib/aws-lambda";
11
11
  import { RetentionDays } from "aws-cdk-lib/aws-logs";
12
12
  import { Size as CDKSize, Duration as CDKDuration } from "aws-cdk-lib/core";
13
- import { IBucket } from "aws-cdk-lib/aws-s3";
13
+ import { Asset } from "aws-cdk-lib/aws-s3-assets";
14
14
  declare const supportedRuntimes: {
15
15
  container: CDKRuntime;
16
16
  rust: CDKRuntime;
17
- "nodejs14.x": CDKRuntime;
18
17
  "nodejs16.x": CDKRuntime;
19
18
  "nodejs18.x": CDKRuntime;
20
19
  "python3.7": CDKRuntime;
@@ -127,7 +126,7 @@ export interface FunctionProps extends Omit<FunctionOptions, "functionName" | "m
127
126
  * ```js
128
127
  * new Function(stack, "Function", {
129
128
  * handler: "function.handler",
130
- * runtime: "nodejs16.x",
129
+ * runtime: "nodejs18.x",
131
130
  * })
132
131
  *```
133
132
  */
@@ -671,6 +670,7 @@ export declare class Function extends CDKFunction implements SSTConstruct {
671
670
  readonly _isLiveDevEnabled: boolean;
672
671
  /** @internal */
673
672
  readonly _doNotAllowOthersToBind?: boolean;
673
+ private missingSourcemap?;
674
674
  private functionUrl?;
675
675
  private props;
676
676
  private allBindings;
@@ -702,8 +702,9 @@ export declare class Function extends CDKFunction implements SSTConstruct {
702
702
  type: "Function";
703
703
  data: {
704
704
  arn: string;
705
- runtime: "container" | "rust" | "nodejs14.x" | "nodejs16.x" | "nodejs18.x" | "python3.7" | "python3.8" | "python3.9" | "python3.10" | "python3.11" | "dotnetcore3.1" | "dotnet6" | "java8" | "java11" | "java17" | "go1.x" | "go" | undefined;
705
+ runtime: "container" | "rust" | "nodejs16.x" | "nodejs18.x" | "python3.7" | "python3.8" | "python3.9" | "python3.10" | "python3.11" | "dotnetcore3.1" | "dotnet6" | "java8" | "java11" | "java17" | "go1.x" | "go" | undefined;
706
706
  handler: string | undefined;
707
+ missingSourcemap: boolean | undefined;
707
708
  localId: string;
708
709
  secrets: string[];
709
710
  };
@@ -727,13 +728,11 @@ export declare class Function extends CDKFunction implements SSTConstruct {
727
728
  export declare const useFunctions: () => {
728
729
  sourcemaps: {
729
730
  add(stack: string, source: {
730
- srcBucket: IBucket;
731
- srcKey: string;
731
+ asset: Asset;
732
732
  tarKey: string;
733
733
  }): void;
734
734
  forStack(stack: string): {
735
- srcBucket: IBucket;
736
- srcKey: string;
735
+ asset: Asset;
737
736
  tarKey: string;
738
737
  }[];
739
738
  };
@@ -31,7 +31,6 @@ const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
31
31
  const supportedRuntimes = {
32
32
  container: CDKRuntime.FROM_IMAGE,
33
33
  rust: CDKRuntime.PROVIDED_AL2,
34
- "nodejs14.x": CDKRuntime.NODEJS_14_X,
35
34
  "nodejs16.x": CDKRuntime.NODEJS_16_X,
36
35
  "nodejs18.x": CDKRuntime.NODEJS_18_X,
37
36
  "python3.7": CDKRuntime.PYTHON_3_7,
@@ -65,6 +64,7 @@ export class Function extends CDKFunction {
65
64
  _isLiveDevEnabled;
66
65
  /** @internal */
67
66
  _doNotAllowOthersToBind;
67
+ missingSourcemap;
68
68
  functionUrl;
69
69
  props;
70
70
  allBindings = [];
@@ -113,7 +113,7 @@ export class Function extends CDKFunction {
113
113
  code: Code.fromInline("export function placeholder() {}"),
114
114
  handler: "index.placeholder",
115
115
  functionName,
116
- runtime: CDKRuntime.NODEJS_16_X,
116
+ runtime: CDKRuntime.NODEJS_18_X,
117
117
  memorySize,
118
118
  ephemeralStorageSize: diskSize,
119
119
  timeout,
@@ -220,7 +220,7 @@ export class Function extends CDKFunction {
220
220
  : {
221
221
  code: Code.fromInline("export function placeholder() {}"),
222
222
  handler: "index.placeholder",
223
- runtime: CDKRuntime.NODEJS_16_X,
223
+ runtime: CDKRuntime.NODEJS_18_X,
224
224
  layers: Function.buildLayers(scope, id, props),
225
225
  }),
226
226
  architecture,
@@ -256,11 +256,11 @@ export class Function extends CDKFunction {
256
256
  });
257
257
  await fs.rm(result.sourcemap);
258
258
  useFunctions().sourcemaps.add(stack.stackName, {
259
- srcBucket: asset.bucket,
260
- srcKey: asset.s3ObjectKey,
259
+ asset,
261
260
  tarKey: this.functionArn,
262
261
  });
263
262
  }
263
+ this.missingSourcemap = !result.sourcemap;
264
264
  // Update code
265
265
  const cfnFunction = this.node.defaultChild;
266
266
  const code = AssetCode.fromAsset(result.out);
@@ -369,6 +369,7 @@ export class Function extends CDKFunction {
369
369
  arn: this.functionArn,
370
370
  runtime: this.props.runtime,
371
371
  handler: this.props.handler,
372
+ missingSourcemap: this.missingSourcemap === true ? true : undefined,
372
373
  localId: this.node.addr,
373
374
  secrets: this.allBindings
374
375
  .filter((c) => c instanceof Secret)
@@ -581,7 +582,13 @@ export const useFunctions = createAppContext(() => {
581
582
  arr.push(source);
582
583
  },
583
584
  forStack(stack) {
584
- return sourcemaps[stack] || [];
585
+ return (sourcemaps[stack] || []).sort((a, b) => {
586
+ if (a.asset.node.path > b.asset.node.path)
587
+ return 1;
588
+ if (a.asset.node.path < b.asset.node.path)
589
+ return -1;
590
+ return 0;
591
+ });
585
592
  },
586
593
  },
587
594
  fromID(id) {
package/constructs/Job.js CHANGED
@@ -307,7 +307,7 @@ export class Job extends Construct {
307
307
  return new CdkFunction(this, "Manager", {
308
308
  code: Code.fromAsset(path.join(__dirname, "../support/job-manager/")),
309
309
  handler: "index.handler",
310
- runtime: Runtime.NODEJS_16_X,
310
+ runtime: Runtime.NODEJS_18_X,
311
311
  timeout: CdkDuration.seconds(10),
312
312
  memorySize: 1024,
313
313
  environment: {
@@ -68,6 +68,7 @@ export interface NextjsSiteProps extends Omit<SsrSiteProps, "nodejs"> {
68
68
  * experimental: {
69
69
  * disableIncrementalCache: true,
70
70
  * }
71
+ * ```
71
72
  */
72
73
  disableIncrementalCache?: boolean;
73
74
  /**
@@ -150,7 +151,7 @@ export declare class NextjsSite extends SsrSite {
150
151
  layers: import("aws-cdk-lib/aws-lambda").ILayerVersion[] | undefined;
151
152
  handler: string;
152
153
  bundle?: string | undefined;
153
- runtime?: "nodejs14.x" | "nodejs16.x" | "nodejs18.x" | undefined;
154
+ runtime?: "nodejs16.x" | "nodejs18.x" | undefined;
154
155
  timeout?: number | `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | undefined;
155
156
  memorySize?: number | `${number} MB` | `${number} GB` | undefined;
156
157
  permissions?: import("./index.js").Permissions | undefined;
@@ -197,20 +198,10 @@ export declare class NextjsSite extends SsrSite {
197
198
  layers: import("aws-cdk-lib/aws-lambda").ILayerVersion[] | undefined;
198
199
  handler: string;
199
200
  bundle?: string | undefined;
200
- runtime?: "nodejs14.x" | "nodejs16.x" | "nodejs18.x" | undefined;
201
+ runtime?: "nodejs16.x" | "nodejs18.x" | undefined;
201
202
  timeout?: number | `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | undefined;
202
203
  memorySize?: number | `${number} MB` | `${number} GB` | undefined;
203
204
  permissions?: import("./index.js").Permissions | undefined;
204
- /**
205
- * How the logs are stored in CloudWatch
206
- * - "combined" - Logs from all routes are stored in the same log group.
207
- * - "per-route" - Logs from each route are stored in a separate log group.
208
- * @default "per-route"
209
- * @example
210
- * ```js
211
- * logging: "combined",
212
- * ```
213
- */
214
205
  environment?: Record<string, string> | undefined;
215
206
  bind?: import("./Construct.js").SSTConstruct[] | undefined;
216
207
  nodejs?: import("./Function.js").NodeJSProps | undefined;
@@ -257,7 +248,7 @@ export declare class NextjsSite extends SsrSite {
257
248
  layers: import("aws-cdk-lib/aws-lambda").ILayerVersion[] | undefined;
258
249
  handler: string;
259
250
  bundle?: string | undefined;
260
- runtime?: "nodejs14.x" | "nodejs16.x" | "nodejs18.x" | undefined;
251
+ runtime?: "nodejs16.x" | "nodejs18.x" | undefined;
261
252
  timeout?: number | `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | undefined;
262
253
  memorySize?: number | `${number} MB` | `${number} GB` | undefined;
263
254
  permissions?: import("./index.js").Permissions | undefined;
@@ -304,20 +295,10 @@ export declare class NextjsSite extends SsrSite {
304
295
  layers: import("aws-cdk-lib/aws-lambda").ILayerVersion[] | undefined;
305
296
  handler: string;
306
297
  bundle?: string | undefined;
307
- runtime?: "nodejs14.x" | "nodejs16.x" | "nodejs18.x" | undefined;
298
+ runtime?: "nodejs16.x" | "nodejs18.x" | undefined;
308
299
  timeout?: number | `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | undefined;
309
300
  memorySize?: number | `${number} MB` | `${number} GB` | undefined;
310
301
  permissions?: import("./index.js").Permissions | undefined;
311
- /**
312
- * How the logs are stored in CloudWatch
313
- * - "combined" - Logs from all routes are stored in the same log group.
314
- * - "per-route" - Logs from each route are stored in a separate log group.
315
- * @default "per-route"
316
- * @example
317
- * ```js
318
- * logging: "combined",
319
- * ```
320
- */
321
302
  environment?: Record<string, string> | undefined;
322
303
  bind?: import("./Construct.js").SSTConstruct[] | undefined;
323
304
  nodejs?: import("./Function.js").NodeJSProps | undefined;
@@ -357,7 +338,7 @@ export declare class NextjsSite extends SsrSite {
357
338
  } | undefined;
358
339
  mode: "placeholder" | "deployed";
359
340
  path: string;
360
- runtime: "nodejs14.x" | "nodejs16.x" | "nodejs18.x";
341
+ runtime: "nodejs16.x" | "nodejs18.x";
361
342
  customDomainUrl: string | undefined;
362
343
  url: string | undefined;
363
344
  edge: boolean | undefined;
@@ -377,6 +358,7 @@ export declare class NextjsSite extends SsrSite {
377
358
  private getSourcemapForAppRoute;
378
359
  private getSourcemapForPagesRoute;
379
360
  private isPerRouteLoggingEnabled;
361
+ private handleMissingSourcemap;
380
362
  private disableDefaultLogging;
381
363
  private uploadSourcemaps;
382
364
  private static buildCloudWatchRouteName;
@@ -73,6 +73,7 @@ export class NextjsSite extends SsrSite {
73
73
  ].join(" "),
74
74
  ...props,
75
75
  });
76
+ this.handleMissingSourcemap();
76
77
  if (this.isPerRouteLoggingEnabled()) {
77
78
  this.disableDefaultLogging();
78
79
  this.uploadSourcemaps();
@@ -570,6 +571,14 @@ export class NextjsSite extends SsrSite {
570
571
  !this.props.edge &&
571
572
  this.props.logging === "per-route");
572
573
  }
574
+ handleMissingSourcemap() {
575
+ if (this.doNotDeploy || this.props.edge)
576
+ return;
577
+ const hasMissingSourcemap = this.useRoutes().every(({ sourcemapPath, sourcemapKey }) => !sourcemapPath || !sourcemapKey);
578
+ if (!hasMissingSourcemap)
579
+ return;
580
+ this.serverFunction._overrideMissingSourcemap();
581
+ }
573
582
  disableDefaultLogging() {
574
583
  const stack = Stack.of(this);
575
584
  const server = this.serverFunction;
@@ -606,8 +615,7 @@ export class NextjsSite extends SsrSite {
606
615
  path: zipPath,
607
616
  });
608
617
  useFunctions().sourcemaps.add(stack.stackName, {
609
- srcBucket: asset.bucket,
610
- srcKey: asset.s3ObjectKey,
618
+ asset,
611
619
  tarKey: path.join(server.functionArn, sourcemapKey),
612
620
  });
613
621
  });
@@ -53,7 +53,7 @@ export interface RDSProps {
53
53
  maxCapacity?: keyof typeof AuroraCapacityUnit;
54
54
  };
55
55
  /**
56
- * Path to the directory that contains the migration scripts. The `RDS` construct uses [Kysely](https://kysely-org.github.io/kysely/) to run and manage schema migrations. The `migrations` prop should point to the folder where your migration files are.
56
+ * Path to the directory that contains the migration scripts. The `RDS` construct uses [Kysely](https://kysely.dev/) to run and manage schema migrations. The `migrations` prop should point to the folder where your migration files are.
57
57
  *
58
58
  * @example
59
59
  *
package/constructs/RDS.js CHANGED
@@ -284,7 +284,7 @@ export class RDS extends Construct {
284
284
  // For now we will do `__dirname/../dist` to make both cases work.
285
285
  this.migratorFunction = new Fn(this, "MigrationFunction", {
286
286
  handler: path.resolve(path.join(__dirname, "../support/rds-migrator/index.handler")),
287
- runtime: "nodejs16.x",
287
+ runtime: "nodejs18.x",
288
288
  timeout: 900,
289
289
  memorySize: 1024,
290
290
  environment: {
@@ -318,7 +318,7 @@ export class RDS extends Construct {
318
318
  // Create custom resource handler
319
319
  const handler = new Function(this, "MigrationHandler", {
320
320
  code: Code.fromAsset(path.join(__dirname, "../support/script-function")),
321
- runtime: Runtime.NODEJS_16_X,
321
+ runtime: Runtime.NODEJS_18_X,
322
322
  handler: "index.handler",
323
323
  timeout: CDKDuration.minutes(15),
324
324
  memorySize: 1024,
@@ -99,7 +99,7 @@ export declare class RemixSite extends SsrSite {
99
99
  data: {
100
100
  mode: "placeholder" | "deployed";
101
101
  path: string;
102
- runtime: "nodejs14.x" | "nodejs16.x" | "nodejs18.x";
102
+ runtime: "nodejs16.x" | "nodejs18.x";
103
103
  customDomainUrl: string | undefined;
104
104
  url: string | undefined;
105
105
  edge: boolean | undefined;
@@ -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_16_X,
124
+ runtime: Runtime.NODEJS_18_X,
125
125
  handler: "index.handler",
126
126
  timeout: Duration.minutes(15),
127
127
  memorySize: 1024,
@@ -79,7 +79,7 @@ export declare class SolidStartSite extends SsrSite {
79
79
  data: {
80
80
  mode: "placeholder" | "deployed";
81
81
  path: string;
82
- runtime: "nodejs14.x" | "nodejs16.x" | "nodejs18.x";
82
+ runtime: "nodejs16.x" | "nodejs18.x";
83
83
  customDomainUrl: string | undefined;
84
84
  url: string | undefined;
85
85
  edge: boolean | undefined;
@@ -10,7 +10,7 @@ import { Duration } from "./util/duration.js";
10
10
  export interface SsrFunctionProps extends Omit<FunctionOptions, "memorySize" | "timeout" | "runtime"> {
11
11
  bundle?: string;
12
12
  handler: string;
13
- runtime?: "nodejs14.x" | "nodejs16.x" | "nodejs18.x";
13
+ runtime?: "nodejs16.x" | "nodejs18.x";
14
14
  timeout?: number | Duration;
15
15
  memorySize?: number | Size;
16
16
  permissions?: Permissions;
@@ -27,6 +27,7 @@ export declare class SsrFunction extends Construct implements SSTConstruct {
27
27
  function: CdkFunction;
28
28
  private assetReplacer;
29
29
  private assetReplacerPolicy;
30
+ private missingSourcemap?;
30
31
  private props;
31
32
  constructor(scope: Construct, id: string, props: SsrFunctionProps);
32
33
  get role(): import("aws-cdk-lib/aws-iam").IRole | undefined;
@@ -36,6 +37,7 @@ export declare class SsrFunction extends Construct implements SSTConstruct {
36
37
  addFunctionUrl(props?: FunctionUrlOptions): import("aws-cdk-lib/aws-lambda").FunctionUrl;
37
38
  grantInvoke(grantee: IGrantable): import("aws-cdk-lib/aws-iam").Grant;
38
39
  attachPermissions(permissions: Permissions): void;
40
+ _overrideMissingSourcemap(): void;
39
41
  private createFunction;
40
42
  private createCodeReplacer;
41
43
  private bind;
@@ -48,8 +50,9 @@ export declare class SsrFunction extends Construct implements SSTConstruct {
48
50
  type: "Function";
49
51
  data: {
50
52
  arn: string;
51
- runtime: "nodejs14.x" | "nodejs16.x" | "nodejs18.x" | undefined;
53
+ runtime: "nodejs16.x" | "nodejs18.x" | undefined;
52
54
  handler: string;
55
+ missingSourcemap: boolean | undefined;
53
56
  localId: string;
54
57
  secrets: string[];
55
58
  };
@@ -30,6 +30,7 @@ export class SsrFunction extends Construct {
30
30
  function;
31
31
  assetReplacer;
32
32
  assetReplacerPolicy;
33
+ missingSourcemap;
33
34
  props;
34
35
  constructor(scope, id, props) {
35
36
  super(scope, id);
@@ -86,6 +87,9 @@ export class SsrFunction extends Construct {
86
87
  attachPermissions(permissions) {
87
88
  attachPermissionsToRole(this.function.role, permissions);
88
89
  }
90
+ _overrideMissingSourcemap() {
91
+ this.missingSourcemap = true;
92
+ }
89
93
  createFunction(assetBucket, assetKey) {
90
94
  const { architecture, runtime, timeout, memorySize, handler, logRetention, } = this.props;
91
95
  return new CdkFunction(this, `ServerFunction`, {
@@ -93,11 +97,7 @@ export class SsrFunction extends Construct {
93
97
  handler: handler.split(path.sep).join(path.posix.sep),
94
98
  logRetention: logRetention ?? RetentionDays.THREE_DAYS,
95
99
  code: Code.fromBucket(Bucket.fromBucketName(this, "IServerFunctionBucket", assetBucket), assetKey),
96
- runtime: runtime === "nodejs14.x"
97
- ? Runtime.NODEJS_14_X
98
- : runtime === "nodejs16.x"
99
- ? Runtime.NODEJS_16_X
100
- : Runtime.NODEJS_18_X,
100
+ runtime: runtime === "nodejs16.x" ? Runtime.NODEJS_16_X : Runtime.NODEJS_18_X,
101
101
  architecture: architecture || Architecture.ARM_64,
102
102
  memorySize: typeof memorySize === "string"
103
103
  ? toCdkSize(memorySize).toMebibytes()
@@ -191,11 +191,11 @@ export class SsrFunction extends Construct {
191
191
  });
192
192
  await fs.rm(result.sourcemap);
193
193
  useFunctions().sourcemaps.add(stack.stackName, {
194
- srcBucket: asset.bucket,
195
- srcKey: asset.s3ObjectKey,
194
+ asset,
196
195
  tarKey: this.functionArn,
197
196
  });
198
197
  }
198
+ this.missingSourcemap = !result.sourcemap;
199
199
  return AssetCode.fromAsset(result.out);
200
200
  }
201
201
  async buildAssetFromBundle(bundle) {
@@ -237,6 +237,7 @@ export class SsrFunction extends Construct {
237
237
  arn: this.functionArn,
238
238
  runtime: this.props.runtime,
239
239
  handler: this.props.handler,
240
+ missingSourcemap: this.missingSourcemap === true ? true : undefined,
240
241
  localId: this.node.addr,
241
242
  secrets: [],
242
243
  },
@@ -138,7 +138,7 @@ export interface SsrSiteProps {
138
138
  * runtime: "nodejs16.x",
139
139
  * ```
140
140
  */
141
- runtime?: "nodejs14.x" | "nodejs16.x" | "nodejs18.x";
141
+ runtime?: "nodejs16.x" | "nodejs18.x";
142
142
  /**
143
143
  * Used to configure nodejs function properties
144
144
  */
@@ -454,7 +454,7 @@ export declare abstract class SsrSite extends Construct implements SSTConstruct
454
454
  data: {
455
455
  mode: "placeholder" | "deployed";
456
456
  path: string;
457
- runtime: "nodejs14.x" | "nodejs16.x" | "nodejs18.x";
457
+ runtime: "nodejs16.x" | "nodejs18.x";
458
458
  customDomainUrl: string | undefined;
459
459
  url: string | undefined;
460
460
  edge: boolean | undefined;
@@ -568,7 +568,7 @@ function handler(event) {
568
568
  return assets;
569
569
  }
570
570
  function createS3OriginDeployment(copy, s3Assets) {
571
- const policy = new Policy(self, "S3UploaderPolicy", {
571
+ const policy = new Policy(self, "S3AssetUploaderPolicy", {
572
572
  statements: [
573
573
  new PolicyStatement({
574
574
  effect: Effect.ALLOW,
@@ -588,7 +588,7 @@ function handler(event) {
588
588
  ],
589
589
  });
590
590
  stack.customResourceHandler.role?.attachInlinePolicy(policy);
591
- const resource = new CustomResource(self, "S3Uploader", {
591
+ const resource = new CustomResource(self, "S3AssetUploader", {
592
592
  serviceToken: stack.customResourceHandler.functionArn,
593
593
  resourceType: "Custom::S3Uploader",
594
594
  properties: {
@@ -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_16_X,
199
+ runtime: lambda.Runtime.NODEJS_18_X,
200
200
  timeout: CDKDuration.seconds(900),
201
201
  memorySize: 1024,
202
202
  });
@@ -110,7 +110,7 @@ export declare class SvelteKitSite extends SsrSite {
110
110
  data: {
111
111
  mode: "placeholder" | "deployed";
112
112
  path: string;
113
- runtime: "nodejs14.x" | "nodejs16.x" | "nodejs18.x";
113
+ runtime: "nodejs16.x" | "nodejs18.x";
114
114
  customDomainUrl: string | undefined;
115
115
  url: string | undefined;
116
116
  edge: boolean | undefined;
@@ -166,9 +166,13 @@ export interface WebSocketApiProps {
166
166
  export interface WebSocketApiFunctionRouteProps {
167
167
  type?: "function";
168
168
  /**
169
- *The function definition used to create the function for this route.
169
+ * The function definition used to create the function for this route.
170
170
  */
171
171
  function: FunctionDefinition;
172
+ /**
173
+ * Should the route send a response to the client.
174
+ */
175
+ returnResponse?: boolean;
172
176
  }
173
177
  /**
174
178
  * Specify a Lambda authorizer and configure additional options.
@@ -363,6 +363,9 @@ export class WebSocketApi extends Construct {
363
363
  routeKey,
364
364
  integration: new WebSocketLambdaIntegration(`Integration_${routeKey}`, lambda),
365
365
  authorizer: routeKey === "$connect" ? authorizer : undefined,
366
+ returnResponse: Fn.isInlineDefinition(routeValue)
367
+ ? undefined
368
+ : routeValue.returnResponse,
366
369
  });
367
370
  ///////////////////
368
371
  // Configure authorization
@@ -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_16_X,
50
+ runtime: lambda.Runtime.NODEJS_18_X,
51
51
  timeout: Duration.minutes(15),
52
52
  role: props.customResourceRole,
53
53
  });
@@ -83,7 +83,7 @@ export interface NextjsSiteProps {
83
83
  * })
84
84
  *```
85
85
  */
86
- runtime?: "nodejs14.x" | "nodejs16.x" | "nodejs18.x";
86
+ runtime?: "nodejs16.x" | "nodejs18.x";
87
87
  };
88
88
  };
89
89
  /**
@@ -1039,10 +1039,7 @@ export class NextjsSite extends Construct {
1039
1039
  return replaceValues;
1040
1040
  }
1041
1041
  normalizeRuntime(runtime) {
1042
- if (runtime === "nodejs14.x") {
1043
- return lambda.Runtime.NODEJS_14_X;
1044
- }
1045
- else if (runtime === "nodejs16.x") {
1042
+ if (runtime === "nodejs16.x") {
1046
1043
  return lambda.Runtime.NODEJS_16_X;
1047
1044
  }
1048
1045
  return lambda.Runtime.NODEJS_18_X;
@@ -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_16_X,
21
+ runtime: lambda.Runtime.NODEJS_18_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_16_X,
53
+ runtime: lambda.Runtime.NODEJS_18_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_16_X,
91
+ runtime: lambda.Runtime.NODEJS_18_X,
92
92
  timeout: Duration.minutes(15),
93
93
  memorySize: 1024,
94
94
  initialPolicy: [
@@ -36,7 +36,7 @@ type Event = {
36
36
  metadataFn: any;
37
37
  };
38
38
  };
39
- type EventPayload<E extends Event> = {
39
+ export type EventPayload<E extends Event> = {
40
40
  type: E["type"];
41
41
  properties: E["shape"]["properties"];
42
42
  metadata: undefined extends E["shape"]["metadata"] ? E["shape"]["metadataFn"] : E["shape"]["metadata"];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.36.0",
4
+ "version": "2.36.2",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
@@ -120,7 +120,7 @@
120
120
  "@types/ws": "^8.5.3",
121
121
  "@types/yargs": "^17.0.13",
122
122
  "archiver": "^5.3.1",
123
- "astro-sst": "2.36.0",
123
+ "astro-sst": "2.36.2",
124
124
  "async": "^3.2.4",
125
125
  "tsx": "^3.12.1",
126
126
  "typescript": "^5.2.2",