sst 2.16.2 → 2.16.4
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/cli/ui/deploy.js +7 -1
- package/constructs/Construct.js +1 -1
- package/constructs/NextjsSite.d.ts +4 -5
- package/constructs/NextjsSite.js +11 -101
- package/constructs/SsrSite.d.ts +4 -3
- package/constructs/SsrSite.js +8 -6
- package/package.json +1 -1
- package/sst.mjs +8 -1
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 (
|
|
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
|
package/constructs/Construct.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Construct } from "constructs";
|
|
2
|
-
import { Function as CdkFunction } from "aws-cdk-lib/aws-lambda";
|
|
2
|
+
import { Function as CdkFunction, FunctionProps } from "aws-cdk-lib/aws-lambda";
|
|
3
3
|
import { Distribution } from "aws-cdk-lib/aws-cloudfront";
|
|
4
4
|
import { EdgeFunction } from "./EdgeFunction.js";
|
|
5
5
|
import { SsrSite, SsrSiteProps } from "./SsrSite.js";
|
|
@@ -21,6 +21,9 @@ export interface NextjsSiteProps extends Omit<SsrSiteProps, "nodejs"> {
|
|
|
21
21
|
* @default Server function is not kept warm
|
|
22
22
|
*/
|
|
23
23
|
warm?: number;
|
|
24
|
+
cdk?: SsrSiteProps["cdk"] & {
|
|
25
|
+
revalidation?: Pick<FunctionProps, "vpc" | "vpcSubnets">;
|
|
26
|
+
};
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
* The `NextjsSite` construct is a higher level CDK construct that makes it easy to create a Next.js app.
|
|
@@ -58,12 +61,8 @@ export declare class NextjsSite extends SsrSite {
|
|
|
58
61
|
private createWarmer;
|
|
59
62
|
protected createCloudFrontDistributionForRegional(): Distribution;
|
|
60
63
|
protected createCloudFrontDistributionForEdge(): Distribution;
|
|
61
|
-
private buildServerBehaviorForRegional;
|
|
62
|
-
private buildServerBehaviorForEdge;
|
|
63
64
|
private buildImageBehavior;
|
|
64
65
|
private buildStaticFileBehavior;
|
|
65
|
-
private buildDefaultNextjsBehaviorForRegional;
|
|
66
|
-
private buildDefaultNextjsBehaviorForEdge;
|
|
67
66
|
protected generateBuildId(): string;
|
|
68
67
|
getConstructMetadata(): {
|
|
69
68
|
data: {
|
package/constructs/NextjsSite.js
CHANGED
|
@@ -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,
|
|
8
|
-
import { S3Origin, HttpOrigin
|
|
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
|
|
@@ -41,6 +40,7 @@ export class NextjsSite extends SsrSite {
|
|
|
41
40
|
createRevalidation() {
|
|
42
41
|
if (!this.serverLambdaForRegional && !this.serverLambdaForEdge)
|
|
43
42
|
return;
|
|
43
|
+
const { cdk } = this.props;
|
|
44
44
|
const queue = new Queue(this, "RevalidationQueue", {
|
|
45
45
|
fifo: true,
|
|
46
46
|
receiveMessageWaitTime: CdkDuration.seconds(20),
|
|
@@ -51,6 +51,7 @@ export class NextjsSite extends SsrSite {
|
|
|
51
51
|
code: Code.fromAsset(path.join(this.props.path, ".open-next", "revalidation-function")),
|
|
52
52
|
runtime: Runtime.NODEJS_18_X,
|
|
53
53
|
timeout: CdkDuration.seconds(30),
|
|
54
|
+
...cdk?.revalidation,
|
|
54
55
|
});
|
|
55
56
|
consumer.addEventSource(new SqsEventSource(queue, { batchSize: 5 }));
|
|
56
57
|
// Allow server to send messages to the queue
|
|
@@ -239,19 +240,11 @@ export class NextjsSite extends SsrSite {
|
|
|
239
240
|
* - Cache-Control: public, max-age=0, must-revalidate
|
|
240
241
|
* - x-vercel-cache: MISS
|
|
241
242
|
*/
|
|
242
|
-
const {
|
|
243
|
+
const { cdk } = this.props;
|
|
243
244
|
const cfDistributionProps = cdk?.distribution || {};
|
|
244
245
|
const s3Origin = new S3Origin(this.cdk.bucket, {
|
|
245
246
|
originPath: "/" + this.buildConfig.clientBuildS3KeyPrefix,
|
|
246
247
|
});
|
|
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
248
|
const cachePolicy = cdk?.serverCachePolicy ??
|
|
256
249
|
this.buildServerCachePolicy([
|
|
257
250
|
"accept",
|
|
@@ -259,8 +252,7 @@ export class NextjsSite extends SsrSite {
|
|
|
259
252
|
"next-router-prefetch",
|
|
260
253
|
"next-router-state-tree",
|
|
261
254
|
]);
|
|
262
|
-
const
|
|
263
|
-
const serverBehavior = this.buildServerBehaviorForRegional(serverOrigin, cachePolicy, originRequestPolicy);
|
|
255
|
+
const serverBehavior = this.buildDefaultBehaviorForRegional(cachePolicy);
|
|
264
256
|
return new Distribution(this, "Distribution", {
|
|
265
257
|
// these values can be overwritten by cfDistributionProps
|
|
266
258
|
defaultRootObject: "",
|
|
@@ -269,12 +261,13 @@ export class NextjsSite extends SsrSite {
|
|
|
269
261
|
// these values can NOT be overwritten by cfDistributionProps
|
|
270
262
|
domainNames: this.buildDistributionDomainNames(),
|
|
271
263
|
certificate: this.cdk.certificate,
|
|
272
|
-
defaultBehavior:
|
|
264
|
+
defaultBehavior: serverBehavior,
|
|
273
265
|
additionalBehaviors: {
|
|
274
266
|
"api/*": serverBehavior,
|
|
275
267
|
"_next/data/*": serverBehavior,
|
|
276
268
|
"_next/image*": this.buildImageBehavior(cachePolicy),
|
|
277
269
|
"_next/*": this.buildStaticFileBehavior(s3Origin),
|
|
270
|
+
...this.buildStaticFileBehaviors(s3Origin),
|
|
278
271
|
...(cfDistributionProps.additionalBehaviors || {}),
|
|
279
272
|
},
|
|
280
273
|
});
|
|
@@ -292,9 +285,7 @@ export class NextjsSite extends SsrSite {
|
|
|
292
285
|
"next-router-prefetch",
|
|
293
286
|
"next-router-state-tree",
|
|
294
287
|
]);
|
|
295
|
-
const
|
|
296
|
-
const functionVersion = this.serverLambdaForEdge.currentVersion;
|
|
297
|
-
const serverBehavior = this.buildServerBehaviorForEdge(functionVersion, s3Origin, cachePolicy, originRequestPolicy);
|
|
288
|
+
const serverBehavior = this.buildDefaultBehaviorForEdge(s3Origin, cachePolicy);
|
|
298
289
|
return new Distribution(this, "Distribution", {
|
|
299
290
|
// these values can be overwritten by cfDistributionProps
|
|
300
291
|
defaultRootObject: "",
|
|
@@ -303,51 +294,17 @@ export class NextjsSite extends SsrSite {
|
|
|
303
294
|
// these values can NOT be overwritten by cfDistributionProps
|
|
304
295
|
domainNames: this.buildDistributionDomainNames(),
|
|
305
296
|
certificate: this.cdk.certificate,
|
|
306
|
-
defaultBehavior:
|
|
297
|
+
defaultBehavior: serverBehavior,
|
|
307
298
|
additionalBehaviors: {
|
|
308
299
|
"api/*": serverBehavior,
|
|
309
300
|
"_next/data/*": serverBehavior,
|
|
310
301
|
"_next/image*": this.buildImageBehavior(cachePolicy),
|
|
311
302
|
"_next/*": this.buildStaticFileBehavior(s3Origin),
|
|
303
|
+
...this.buildStaticFileBehaviors(s3Origin),
|
|
312
304
|
...(cfDistributionProps.additionalBehaviors || {}),
|
|
313
305
|
},
|
|
314
306
|
});
|
|
315
307
|
}
|
|
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
308
|
buildImageBehavior(cachePolicy) {
|
|
352
309
|
const { cdk } = this.props;
|
|
353
310
|
const imageFn = this.createImageOptimizationFunction();
|
|
@@ -376,53 +333,6 @@ export class NextjsSite extends SsrSite {
|
|
|
376
333
|
responseHeadersPolicy: cdk?.responseHeadersPolicy,
|
|
377
334
|
};
|
|
378
335
|
}
|
|
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
336
|
generateBuildId() {
|
|
427
337
|
const filePath = path.join(this.props.path, ".next/BUILD_ID");
|
|
428
338
|
return fs.readFileSync(filePath).toString();
|
package/constructs/SsrSite.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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;
|
package/constructs/SsrSite.js
CHANGED
|
@@ -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
|
|
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
|
|
597
|
+
cachePolicy,
|
|
596
598
|
responseHeadersPolicy: cdk?.responseHeadersPolicy,
|
|
597
599
|
originRequestPolicy: this.buildServerOriginRequestPolicy(),
|
|
598
600
|
...(cfDistributionProps.defaultBehavior || {}),
|
package/package.json
CHANGED
package/sst.mjs
CHANGED
|
@@ -6222,7 +6222,14 @@ function logicalIdToCdkPath(assembly, stack, logicalId) {
|
|
|
6222
6222
|
return found.split("/").filter(Boolean).slice(1, -1).join("/");
|
|
6223
6223
|
}
|
|
6224
6224
|
function getHelper(error2) {
|
|
6225
|
-
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
|
+
}
|
|
6226
6233
|
}
|
|
6227
6234
|
function getApiAccessLogPermissionsHelper(error2) {
|
|
6228
6235
|
if (error2.indexOf("Insufficient permissions to enable logging") > -1) {
|