sst 2.36.0 → 2.36.1

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.
@@ -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) {
package/constructs/App.js CHANGED
@@ -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();
@@ -671,6 +671,7 @@ export declare class Function extends CDKFunction implements SSTConstruct {
671
671
  readonly _isLiveDevEnabled: boolean;
672
672
  /** @internal */
673
673
  readonly _doNotAllowOthersToBind?: boolean;
674
+ private missingSourcemap?;
674
675
  private functionUrl?;
675
676
  private props;
676
677
  private allBindings;
@@ -704,6 +705,7 @@ export declare class Function extends CDKFunction implements SSTConstruct {
704
705
  arn: string;
705
706
  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;
706
707
  handler: string | undefined;
708
+ missingSourcemap: boolean | undefined;
707
709
  localId: string;
708
710
  secrets: string[];
709
711
  };
@@ -65,6 +65,7 @@ export class Function extends CDKFunction {
65
65
  _isLiveDevEnabled;
66
66
  /** @internal */
67
67
  _doNotAllowOthersToBind;
68
+ missingSourcemap;
68
69
  functionUrl;
69
70
  props;
70
71
  allBindings = [];
@@ -261,6 +262,7 @@ export class Function extends CDKFunction {
261
262
  tarKey: this.functionArn,
262
263
  });
263
264
  }
265
+ this.missingSourcemap = !result.sourcemap;
264
266
  // Update code
265
267
  const cfnFunction = this.node.defaultChild;
266
268
  const code = AssetCode.fromAsset(result.out);
@@ -369,6 +371,7 @@ export class Function extends CDKFunction {
369
371
  arn: this.functionArn,
370
372
  runtime: this.props.runtime,
371
373
  handler: this.props.handler,
374
+ missingSourcemap: this.missingSourcemap === true ? true : undefined,
372
375
  localId: this.node.addr,
373
376
  secrets: this.allBindings
374
377
  .filter((c) => c instanceof Secret)
@@ -377,6 +377,7 @@ export declare class NextjsSite extends SsrSite {
377
377
  private getSourcemapForAppRoute;
378
378
  private getSourcemapForPagesRoute;
379
379
  private isPerRouteLoggingEnabled;
380
+ private handleMissingSourcemap;
380
381
  private disableDefaultLogging;
381
382
  private uploadSourcemaps;
382
383
  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;
@@ -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;
@@ -50,6 +52,7 @@ export declare class SsrFunction extends Construct implements SSTConstruct {
50
52
  arn: string;
51
53
  runtime: "nodejs14.x" | "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`, {
@@ -196,6 +200,7 @@ export class SsrFunction extends Construct {
196
200
  tarKey: this.functionArn,
197
201
  });
198
202
  }
203
+ this.missingSourcemap = !result.sourcemap;
199
204
  return AssetCode.fromAsset(result.out);
200
205
  }
201
206
  async buildAssetFromBundle(bundle) {
@@ -237,6 +242,7 @@ export class SsrFunction extends Construct {
237
242
  arn: this.functionArn,
238
243
  runtime: this.props.runtime,
239
244
  handler: this.props.handler,
245
+ missingSourcemap: this.missingSourcemap === true ? true : undefined,
240
246
  localId: this.node.addr,
241
247
  secrets: [],
242
248
  },
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.1",
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.1",
124
124
  "async": "^3.2.4",
125
125
  "tsx": "^3.12.1",
126
126
  "typescript": "^5.2.2",