sst 2.16.1 → 2.16.3

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.
@@ -14,4 +14,6 @@ export declare const diff: (program: Program) => import("yargs").Argv<{
14
14
  future: boolean | undefined;
15
15
  } & {
16
16
  dev: boolean | undefined;
17
+ } & {
18
+ to: string | undefined;
17
19
  }>;
@@ -1,7 +1,12 @@
1
1
  import { stackNameToId } from "../ui/stack.js";
2
- export const diff = (program) => program.command("diff", "Compare your app with what is deployed on AWS", (yargs) => yargs.option("dev", {
2
+ export const diff = (program) => program.command("diff", "Compare your app with what is deployed on AWS", (yargs) => yargs
3
+ .option("dev", {
3
4
  type: "boolean",
4
5
  describe: "Compare in dev mode",
6
+ })
7
+ .option("to", {
8
+ type: "string",
9
+ describe: "Output directory, defaults to .sst/dist",
5
10
  }), async (args) => {
6
11
  const { useProject } = await import("../../project.js");
7
12
  const { Stacks } = await import("../../stacks/index.js");
@@ -14,6 +19,7 @@ export const diff = (program) => program.command("diff", "Compare your app with
14
19
  const [_metafile, sstConfig] = await Stacks.load(project.paths.config);
15
20
  const assembly = await Stacks.synth({
16
21
  fn: sstConfig.stacks,
22
+ buildDir: args.to,
17
23
  mode: args.dev ? "dev" : "deploy",
18
24
  });
19
25
  // Diff each stack
package/cli/ui/deploy.js CHANGED
@@ -111,10 +111,16 @@ function logicalIdToCdkPath(assembly, stack, logicalId) {
111
111
  return found.split("/").filter(Boolean).slice(1, -1).join("/");
112
112
  }
113
113
  function getHelper(error) {
114
- return (getApiAccessLogPermissionsHelper(error) ||
114
+ return (getCloudFrontBehaviorLimitHelper(error) ||
115
+ getApiAccessLogPermissionsHelper(error) ||
115
116
  getAppSyncMultiResolverHelper(error) ||
116
117
  getApiLogRoleHelper(error));
117
118
  }
119
+ function getCloudFrontBehaviorLimitHelper(error) {
120
+ if (error.indexOf("Your request contains more CacheBehaviors than are allowed per distribution.") > -1) {
121
+ return `This error often occurs when deploying a frontend with a large number of top-level files and folders in the assets directory. Check out this doc on how to resolve the issue - https://docs.sst.dev/known-issues#cloudfront-cachebehaviors-limit-exceeded`;
122
+ }
123
+ }
118
124
  function getApiAccessLogPermissionsHelper(error) {
119
125
  // Can run into this issue when enabling access logs for API Gateway
120
126
  // note: this should be handled in SST as access log group names are now
@@ -8,7 +8,7 @@ export function getFunctionRef(fn) {
8
8
  return undefined;
9
9
  return {
10
10
  node: fn.node.addr,
11
- stack: Stack.of(fn).node.id,
11
+ stack: Stack.of(fn).stackName,
12
12
  };
13
13
  }
14
14
  export function isConstruct(construct) {
@@ -58,12 +58,8 @@ export declare class NextjsSite extends SsrSite {
58
58
  private createWarmer;
59
59
  protected createCloudFrontDistributionForRegional(): Distribution;
60
60
  protected createCloudFrontDistributionForEdge(): Distribution;
61
- private buildServerBehaviorForRegional;
62
- private buildServerBehaviorForEdge;
63
61
  private buildImageBehavior;
64
62
  private buildStaticFileBehavior;
65
- private buildDefaultNextjsBehaviorForRegional;
66
- private buildDefaultNextjsBehaviorForEdge;
67
63
  protected generateBuildId(): string;
68
64
  getConstructMetadata(): {
69
65
  data: {
@@ -4,8 +4,8 @@ import { Fn, Duration as CdkDuration, RemovalPolicy, CustomResource, } from "aws
4
4
  import { Effect, Policy, PolicyStatement } from "aws-cdk-lib/aws-iam";
5
5
  import { RetentionDays } from "aws-cdk-lib/aws-logs";
6
6
  import { Function as CdkFunction, Code, Runtime, Architecture, FunctionUrlAuthType, } from "aws-cdk-lib/aws-lambda";
7
- import { Distribution, ViewerProtocolPolicy, AllowedMethods, LambdaEdgeEventType, CachedMethods, CachePolicy, } from "aws-cdk-lib/aws-cloudfront";
8
- import { S3Origin, HttpOrigin, OriginGroup, } from "aws-cdk-lib/aws-cloudfront-origins";
7
+ import { Distribution, ViewerProtocolPolicy, AllowedMethods, CachedMethods, CachePolicy, } from "aws-cdk-lib/aws-cloudfront";
8
+ import { S3Origin, HttpOrigin } from "aws-cdk-lib/aws-cloudfront-origins";
9
9
  import { Rule, Schedule } from "aws-cdk-lib/aws-events";
10
10
  import { LambdaFunction } from "aws-cdk-lib/aws-events-targets";
11
11
  import { Queue } from "aws-cdk-lib/aws-sqs";
@@ -15,7 +15,6 @@ import { SsrFunction } from "./SsrFunction.js";
15
15
  import { EdgeFunction } from "./EdgeFunction.js";
16
16
  import { SsrSite } from "./SsrSite.js";
17
17
  import { toCdkSize } from "./util/size.js";
18
- import { toCdkDuration } from "./util/duration.js";
19
18
  /**
20
19
  * The `NextjsSite` construct is a higher level CDK construct that makes it easy to create a Next.js app.
21
20
  * @example
@@ -239,19 +238,11 @@ export class NextjsSite extends SsrSite {
239
238
  * - Cache-Control: public, max-age=0, must-revalidate
240
239
  * - x-vercel-cache: MISS
241
240
  */
242
- const { timeout, cdk } = this.props;
241
+ const { cdk } = this.props;
243
242
  const cfDistributionProps = cdk?.distribution || {};
244
243
  const s3Origin = new S3Origin(this.cdk.bucket, {
245
244
  originPath: "/" + this.buildConfig.clientBuildS3KeyPrefix,
246
245
  });
247
- const serverFnUrl = this.serverLambdaForRegional.addFunctionUrl({
248
- authType: FunctionUrlAuthType.NONE,
249
- });
250
- const serverOrigin = new HttpOrigin(Fn.parseDomainName(serverFnUrl.url), {
251
- readTimeout: typeof timeout === "string"
252
- ? toCdkDuration(timeout)
253
- : CdkDuration.seconds(timeout),
254
- });
255
246
  const cachePolicy = cdk?.serverCachePolicy ??
256
247
  this.buildServerCachePolicy([
257
248
  "accept",
@@ -259,8 +250,7 @@ export class NextjsSite extends SsrSite {
259
250
  "next-router-prefetch",
260
251
  "next-router-state-tree",
261
252
  ]);
262
- const originRequestPolicy = this.buildServerOriginRequestPolicy();
263
- const serverBehavior = this.buildServerBehaviorForRegional(serverOrigin, cachePolicy, originRequestPolicy);
253
+ const serverBehavior = this.buildDefaultBehaviorForRegional(cachePolicy);
264
254
  return new Distribution(this, "Distribution", {
265
255
  // these values can be overwritten by cfDistributionProps
266
256
  defaultRootObject: "",
@@ -269,12 +259,13 @@ export class NextjsSite extends SsrSite {
269
259
  // these values can NOT be overwritten by cfDistributionProps
270
260
  domainNames: this.buildDistributionDomainNames(),
271
261
  certificate: this.cdk.certificate,
272
- defaultBehavior: this.buildDefaultNextjsBehaviorForRegional(serverOrigin, s3Origin, cachePolicy, originRequestPolicy),
262
+ defaultBehavior: serverBehavior,
273
263
  additionalBehaviors: {
274
264
  "api/*": serverBehavior,
275
265
  "_next/data/*": serverBehavior,
276
266
  "_next/image*": this.buildImageBehavior(cachePolicy),
277
267
  "_next/*": this.buildStaticFileBehavior(s3Origin),
268
+ ...this.buildStaticFileBehaviors(s3Origin),
278
269
  ...(cfDistributionProps.additionalBehaviors || {}),
279
270
  },
280
271
  });
@@ -292,9 +283,7 @@ export class NextjsSite extends SsrSite {
292
283
  "next-router-prefetch",
293
284
  "next-router-state-tree",
294
285
  ]);
295
- const originRequestPolicy = this.buildServerOriginRequestPolicy();
296
- const functionVersion = this.serverLambdaForEdge.currentVersion;
297
- const serverBehavior = this.buildServerBehaviorForEdge(functionVersion, s3Origin, cachePolicy, originRequestPolicy);
286
+ const serverBehavior = this.buildDefaultBehaviorForEdge(s3Origin, cachePolicy);
298
287
  return new Distribution(this, "Distribution", {
299
288
  // these values can be overwritten by cfDistributionProps
300
289
  defaultRootObject: "",
@@ -303,51 +292,17 @@ export class NextjsSite extends SsrSite {
303
292
  // these values can NOT be overwritten by cfDistributionProps
304
293
  domainNames: this.buildDistributionDomainNames(),
305
294
  certificate: this.cdk.certificate,
306
- defaultBehavior: this.buildDefaultNextjsBehaviorForEdge(functionVersion, s3Origin, cachePolicy, originRequestPolicy),
295
+ defaultBehavior: serverBehavior,
307
296
  additionalBehaviors: {
308
297
  "api/*": serverBehavior,
309
298
  "_next/data/*": serverBehavior,
310
299
  "_next/image*": this.buildImageBehavior(cachePolicy),
311
300
  "_next/*": this.buildStaticFileBehavior(s3Origin),
301
+ ...this.buildStaticFileBehaviors(s3Origin),
312
302
  ...(cfDistributionProps.additionalBehaviors || {}),
313
303
  },
314
304
  });
315
305
  }
316
- buildServerBehaviorForRegional(serverOrigin, cachePolicy, originRequestPolicy) {
317
- const { cdk } = this.props;
318
- return {
319
- viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
320
- functionAssociations: this.buildBehaviorFunctionAssociations(),
321
- origin: serverOrigin,
322
- allowedMethods: AllowedMethods.ALLOW_ALL,
323
- cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
324
- compress: true,
325
- cachePolicy,
326
- responseHeadersPolicy: cdk?.responseHeadersPolicy,
327
- originRequestPolicy,
328
- };
329
- }
330
- buildServerBehaviorForEdge(functionVersion, s3Origin, cachePolicy, originRequestPolicy) {
331
- const { cdk } = this.props;
332
- return {
333
- viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
334
- functionAssociations: this.buildBehaviorFunctionAssociations(),
335
- origin: s3Origin,
336
- allowedMethods: AllowedMethods.ALLOW_ALL,
337
- cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
338
- compress: true,
339
- cachePolicy,
340
- responseHeadersPolicy: cdk?.responseHeadersPolicy,
341
- originRequestPolicy,
342
- edgeLambdas: [
343
- {
344
- includeBody: true,
345
- eventType: LambdaEdgeEventType.ORIGIN_REQUEST,
346
- functionVersion,
347
- },
348
- ],
349
- };
350
- }
351
306
  buildImageBehavior(cachePolicy) {
352
307
  const { cdk } = this.props;
353
308
  const imageFn = this.createImageOptimizationFunction();
@@ -376,53 +331,6 @@ export class NextjsSite extends SsrSite {
376
331
  responseHeadersPolicy: cdk?.responseHeadersPolicy,
377
332
  };
378
333
  }
379
- buildDefaultNextjsBehaviorForRegional(serverOrigin, s3Origin, cachePolicy, originRequestPolicy) {
380
- // Create default behavior
381
- // default handler for requests that don't match any other path:
382
- // - try lambda handler first
383
- // - if failed, fall back to S3
384
- const { cdk } = this.props;
385
- const cfDistributionProps = cdk?.distribution || {};
386
- const fallbackOriginGroup = new OriginGroup({
387
- primaryOrigin: serverOrigin,
388
- fallbackOrigin: s3Origin,
389
- fallbackStatusCodes: [503],
390
- });
391
- return {
392
- origin: fallbackOriginGroup,
393
- viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
394
- functionAssociations: this.buildBehaviorFunctionAssociations(),
395
- compress: true,
396
- cachePolicy,
397
- responseHeadersPolicy: cdk?.responseHeadersPolicy,
398
- originRequestPolicy,
399
- ...(cfDistributionProps.defaultBehavior || {}),
400
- };
401
- }
402
- buildDefaultNextjsBehaviorForEdge(functionVersion, s3Origin, cachePolicy, originRequestPolicy) {
403
- const { cdk } = this.props;
404
- const cfDistributionProps = cdk?.distribution || {};
405
- return {
406
- viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
407
- functionAssociations: this.buildBehaviorFunctionAssociations(),
408
- origin: s3Origin,
409
- allowedMethods: AllowedMethods.ALLOW_ALL,
410
- cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
411
- compress: true,
412
- cachePolicy,
413
- responseHeadersPolicy: cdk?.responseHeadersPolicy,
414
- originRequestPolicy,
415
- ...(cfDistributionProps.defaultBehavior || {}),
416
- edgeLambdas: [
417
- {
418
- includeBody: true,
419
- eventType: LambdaEdgeEventType.ORIGIN_REQUEST,
420
- functionVersion,
421
- },
422
- ...(cfDistributionProps.defaultBehavior?.edgeLambdas || []),
423
- ],
424
- };
425
- }
426
334
  generateBuildId() {
427
335
  const filePath = path.join(this.props.path, ".next/BUILD_ID");
428
336
  return fs.readFileSync(filePath).toString();
@@ -4,6 +4,7 @@ import { Function as CdkFunction, IFunction as ICdkFunction, FunctionProps } fro
4
4
  import { IHostedZone } from "aws-cdk-lib/aws-route53";
5
5
  import { Distribution, ICachePolicy, IResponseHeadersPolicy, BehaviorOptions, CachePolicy, Function as CfFunction, FunctionEventType as CfFunctionEventType } from "aws-cdk-lib/aws-cloudfront";
6
6
  import { ICertificate } from "aws-cdk-lib/aws-certificatemanager";
7
+ import { S3Origin } from "aws-cdk-lib/aws-cloudfront-origins";
7
8
  import { SSTConstruct } from "./Construct.js";
8
9
  import { NodeJSProps } from "./Function.js";
9
10
  import { EdgeFunction } from "./EdgeFunction.js";
@@ -287,13 +288,13 @@ export declare abstract class SsrSite extends Construct implements SSTConstruct
287
288
  protected createCloudFrontDistributionForRegional(): Distribution;
288
289
  protected createCloudFrontDistributionForEdge(): Distribution;
289
290
  protected buildDistributionDomainNames(): string[];
290
- protected buildDefaultBehaviorForRegional(): BehaviorOptions;
291
- private buildDefaultBehaviorForEdge;
291
+ protected buildDefaultBehaviorForRegional(cachePolicy: ICachePolicy): BehaviorOptions;
292
+ protected buildDefaultBehaviorForEdge(origin: S3Origin, cachePolicy: ICachePolicy): BehaviorOptions;
292
293
  protected buildBehaviorFunctionAssociations(): {
293
294
  eventType: CfFunctionEventType;
294
295
  function: CfFunction;
295
296
  }[];
296
- private buildStaticFileBehaviors;
297
+ protected buildStaticFileBehaviors(origin: S3Origin): Record<string, BehaviorOptions>;
297
298
  protected buildServerCachePolicy(allowedHeaders?: string[]): CachePolicy;
298
299
  protected buildServerOriginRequestPolicy(): import("aws-cdk-lib/aws-cloudfront").IOriginRequestPolicy;
299
300
  private createCloudFrontInvalidation;
@@ -504,6 +504,7 @@ function handler(event) {
504
504
  const { cdk } = this.props;
505
505
  const cfDistributionProps = cdk?.distribution || {};
506
506
  const s3Origin = new S3Origin(this.bucket);
507
+ const cachePolicy = cdk?.serverCachePolicy ?? this.buildServerCachePolicy();
507
508
  return new Distribution(this, "Distribution", {
508
509
  // these values can be overwritten by cfDistributionProps
509
510
  defaultRootObject: "",
@@ -512,7 +513,7 @@ function handler(event) {
512
513
  // these values can NOT be overwritten by cfDistributionProps
513
514
  domainNames: this.buildDistributionDomainNames(),
514
515
  certificate: this.certificate,
515
- defaultBehavior: this.buildDefaultBehaviorForRegional(),
516
+ defaultBehavior: this.buildDefaultBehaviorForRegional(cachePolicy),
516
517
  additionalBehaviors: {
517
518
  ...this.buildStaticFileBehaviors(s3Origin),
518
519
  ...(cfDistributionProps.additionalBehaviors || {}),
@@ -523,6 +524,7 @@ function handler(event) {
523
524
  const { cdk } = this.props;
524
525
  const cfDistributionProps = cdk?.distribution || {};
525
526
  const s3Origin = new S3Origin(this.bucket);
527
+ const cachePolicy = cdk?.serverCachePolicy ?? this.buildServerCachePolicy();
526
528
  return new Distribution(this, "Distribution", {
527
529
  // these values can be overwritten by cfDistributionProps
528
530
  defaultRootObject: "",
@@ -531,7 +533,7 @@ function handler(event) {
531
533
  // these values can NOT be overwritten by cfDistributionProps
532
534
  domainNames: this.buildDistributionDomainNames(),
533
535
  certificate: this.certificate,
534
- defaultBehavior: this.buildDefaultBehaviorForEdge(s3Origin),
536
+ defaultBehavior: this.buildDefaultBehaviorForEdge(s3Origin, cachePolicy),
535
537
  additionalBehaviors: {
536
538
  ...this.buildStaticFileBehaviors(s3Origin),
537
539
  ...(cfDistributionProps.additionalBehaviors || {}),
@@ -557,7 +559,7 @@ function handler(event) {
557
559
  }
558
560
  return domainNames;
559
561
  }
560
- buildDefaultBehaviorForRegional() {
562
+ buildDefaultBehaviorForRegional(cachePolicy) {
561
563
  const { timeout, cdk } = this.props;
562
564
  const cfDistributionProps = cdk?.distribution || {};
563
565
  const fnUrl = this.serverLambdaForRegional.addFunctionUrl({
@@ -573,7 +575,7 @@ function handler(event) {
573
575
  allowedMethods: AllowedMethods.ALLOW_ALL,
574
576
  cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
575
577
  compress: true,
576
- cachePolicy: cdk?.serverCachePolicy ?? this.buildServerCachePolicy(),
578
+ cachePolicy,
577
579
  responseHeadersPolicy: cdk?.responseHeadersPolicy,
578
580
  originRequestPolicy: this.buildServerOriginRequestPolicy(),
579
581
  ...(cfDistributionProps.defaultBehavior || {}),
@@ -583,7 +585,7 @@ function handler(event) {
583
585
  ],
584
586
  };
585
587
  }
586
- buildDefaultBehaviorForEdge(origin) {
588
+ buildDefaultBehaviorForEdge(origin, cachePolicy) {
587
589
  const { cdk } = this.props;
588
590
  const cfDistributionProps = cdk?.distribution || {};
589
591
  return {
@@ -592,7 +594,7 @@ function handler(event) {
592
594
  allowedMethods: AllowedMethods.ALLOW_ALL,
593
595
  cachedMethods: CachedMethods.CACHE_GET_HEAD_OPTIONS,
594
596
  compress: true,
595
- cachePolicy: cdk?.serverCachePolicy ?? this.buildServerCachePolicy(),
597
+ cachePolicy,
596
598
  responseHeadersPolicy: cdk?.responseHeadersPolicy,
597
599
  originRequestPolicy: this.buildServerOriginRequestPolicy(),
598
600
  ...(cfDistributionProps.defaultBehavior || {}),
@@ -10,6 +10,7 @@ export interface StaticSiteFileOptions {
10
10
  exclude: string | string[];
11
11
  include: string | string[];
12
12
  cacheControl: string;
13
+ contentType?: string;
13
14
  }
14
15
  export interface StaticSiteProps {
15
16
  /**
@@ -358,18 +358,19 @@ interface ImportMeta {
358
358
  BucketName: filenamesAsset.s3BucketName,
359
359
  ObjectKey: filenamesAsset.s3ObjectKey,
360
360
  },
361
- FileOptions: (fileOptions || []).map(({ exclude, include, cacheControl }) => {
361
+ FileOptions: (fileOptions || []).map(({ exclude, include, cacheControl, contentType }) => {
362
362
  if (typeof exclude === "string") {
363
363
  exclude = [exclude];
364
364
  }
365
365
  if (typeof include === "string") {
366
366
  include = [include];
367
367
  }
368
- const options = [];
369
- exclude.forEach((per) => options.push("--exclude", per));
370
- include.forEach((per) => options.push("--include", per));
371
- options.push("--cache-control", cacheControl);
372
- return options;
368
+ return [
369
+ ...exclude.map((per) => ["--exclude", per]),
370
+ ...include.map((per) => ["--include", per]),
371
+ ["--cache-control", cacheControl],
372
+ contentType ? ["--content-type", contentType] : [],
373
+ ].flat();
373
374
  }),
374
375
  ReplaceValues: this.getS3ContentReplaceValues(),
375
376
  },
@@ -482,6 +483,10 @@ function handler(event) {
482
483
  var request = event.request;
483
484
  var uri = request.uri;
484
485
 
486
+ if (uri.startsWith("/.well-known/")) {
487
+ return request;
488
+ }
489
+
485
490
  if (uri.endsWith("/")) {
486
491
  request.uri += "index.html";
487
492
  } else if (!uri.split("/").pop().includes(".")) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.16.1",
4
+ "version": "2.16.3",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
@@ -95,6 +95,7 @@ export const usePythonHandler = Context.memo(async () => {
95
95
  installCommands: input.props.python?.installCommands,
96
96
  entry: src,
97
97
  runtime: RUNTIME_MAP[input.props.runtime],
98
+ architecture: input.props.architecture,
98
99
  outputPathSuffix: ".",
99
100
  out: input.out,
100
101
  });
@@ -1,4 +1,5 @@
1
1
  import { Runtime } from "aws-cdk-lib/aws-lambda";
2
+ import { FunctionProps } from "../../constructs/Function.js";
2
3
  import { AssetHashType } from "aws-cdk-lib/core";
3
4
  /**
4
5
  * Dependency files to exclude from the asset hash.
@@ -20,6 +21,10 @@ export interface BundlingOptions {
20
21
  * The runtime of the lambda function
21
22
  */
22
23
  readonly runtime: Runtime;
24
+ /**
25
+ * Architecture used by the lambda function
26
+ */
27
+ readonly architecture: FunctionProps["architecture"];
23
28
  /**
24
29
  * Output path suffix ('python' for a layer, '.' otherwise)
25
30
  */
@@ -18,7 +18,7 @@ export const BUNDLER_DEPENDENCIES_CACHE = "/var/dependencies";
18
18
  * Produce bundled Lambda asset code
19
19
  */
20
20
  export function bundle(options) {
21
- const { entry, runtime, outputPathSuffix, installCommands } = options;
21
+ const { entry, runtime, architecture, outputPathSuffix, installCommands } = options;
22
22
  const stagedir = FileSystem.mkdtemp("python-bundling-");
23
23
  const hasDeps = stageDependencies(entry, stagedir);
24
24
  const hasInstallCommands = stageInstallCommands(installCommands || [], stagedir);
@@ -35,7 +35,9 @@ export function bundle(options) {
35
35
  fs.copyFileSync(path.join(__dirname, "../../support/python-runtime", dockerfile), path.join(stagedir, dockerfile));
36
36
  const image = DockerImage.fromBuild(stagedir, {
37
37
  buildArgs: {
38
- IMAGE: runtime.bundlingImage.image,
38
+ IMAGE: runtime.bundlingImage.image +
39
+ // the default x86_64 doesn't need to be set explicitly
40
+ (architecture == "arm_64" ? ":latest-arm64" : ""),
39
41
  },
40
42
  file: dockerfile,
41
43
  });
package/sst.mjs CHANGED
@@ -4815,7 +4815,7 @@ import url5 from "url";
4815
4815
  import path11 from "path";
4816
4816
  import { DockerImage, FileSystem } from "aws-cdk-lib/core";
4817
4817
  function bundle(options) {
4818
- const { entry, runtime, outputPathSuffix, installCommands } = options;
4818
+ const { entry, runtime, architecture, outputPathSuffix, installCommands } = options;
4819
4819
  const stagedir = FileSystem.mkdtemp("python-bundling-");
4820
4820
  const hasDeps = stageDependencies(entry, stagedir);
4821
4821
  const hasInstallCommands = stageInstallCommands(
@@ -4829,7 +4829,7 @@ function bundle(options) {
4829
4829
  );
4830
4830
  const image = DockerImage.fromBuild(stagedir, {
4831
4831
  buildArgs: {
4832
- IMAGE: runtime.bundlingImage.image
4832
+ IMAGE: runtime.bundlingImage.image + (architecture == "arm_64" ? ":latest-arm64" : "")
4833
4833
  },
4834
4834
  file: dockerfile
4835
4835
  });
@@ -4985,6 +4985,7 @@ var init_python = __esm({
4985
4985
  installCommands: input.props.python?.installCommands,
4986
4986
  entry: src,
4987
4987
  runtime: RUNTIME_MAP[input.props.runtime],
4988
+ architecture: input.props.architecture,
4988
4989
  outputPathSuffix: ".",
4989
4990
  out: input.out
4990
4991
  });
@@ -6221,7 +6222,14 @@ function logicalIdToCdkPath(assembly, stack, logicalId) {
6221
6222
  return found.split("/").filter(Boolean).slice(1, -1).join("/");
6222
6223
  }
6223
6224
  function getHelper(error2) {
6224
- return getApiAccessLogPermissionsHelper(error2) || getAppSyncMultiResolverHelper(error2) || getApiLogRoleHelper(error2);
6225
+ return getCloudFrontBehaviorLimitHelper(error2) || getApiAccessLogPermissionsHelper(error2) || getAppSyncMultiResolverHelper(error2) || getApiLogRoleHelper(error2);
6226
+ }
6227
+ function getCloudFrontBehaviorLimitHelper(error2) {
6228
+ if (error2.indexOf(
6229
+ "Your request contains more CacheBehaviors than are allowed per distribution."
6230
+ ) > -1) {
6231
+ return `This error often occurs when deploying a frontend with a large number of top-level files and folders in the assets directory. Check out this doc on how to resolve the issue - https://docs.sst.dev/known-issues#cloudfront-cachebehaviors-limit-exceeded`;
6232
+ }
6225
6233
  }
6226
6234
  function getApiAccessLogPermissionsHelper(error2) {
6227
6235
  if (error2.indexOf("Insufficient permissions to enable logging") > -1) {
@@ -8297,6 +8305,9 @@ var diff2 = (program2) => program2.command(
8297
8305
  (yargs2) => yargs2.option("dev", {
8298
8306
  type: "boolean",
8299
8307
  describe: "Compare in dev mode"
8308
+ }).option("to", {
8309
+ type: "string",
8310
+ describe: "Output directory, defaults to .sst/dist"
8300
8311
  }),
8301
8312
  async (args) => {
8302
8313
  const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
@@ -8309,6 +8320,7 @@ var diff2 = (program2) => program2.command(
8309
8320
  const [_metafile, sstConfig] = await Stacks.load(project.paths.config);
8310
8321
  const assembly = await Stacks.synth({
8311
8322
  fn: sstConfig.stacks,
8323
+ buildDir: args.to,
8312
8324
  mode: args.dev ? "dev" : "deploy"
8313
8325
  });
8314
8326
  let changesAcc = 0;