sst 2.11.11 → 2.11.13
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/constructs/NextjsSite.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
|
-
import url from "url";
|
|
3
2
|
import path from "path";
|
|
4
3
|
import { Fn, Duration as CdkDuration, RemovalPolicy, CustomResource, } from "aws-cdk-lib/core";
|
|
5
4
|
import { Effect, Policy, PolicyStatement } from "aws-cdk-lib/aws-iam";
|
|
@@ -14,7 +13,6 @@ import { SsrFunction } from "./SsrFunction.js";
|
|
|
14
13
|
import { EdgeFunction } from "./EdgeFunction.js";
|
|
15
14
|
import { SsrSite } from "./SsrSite.js";
|
|
16
15
|
import { toCdkSize } from "./util/size.js";
|
|
17
|
-
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
18
16
|
/**
|
|
19
17
|
* The `NextjsSite` construct is a higher level CDK construct that makes it easy to create a Next.js app.
|
|
20
18
|
* @example
|
|
@@ -29,7 +27,7 @@ const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
|
29
27
|
export class NextjsSite extends SsrSite {
|
|
30
28
|
constructor(scope, id, props) {
|
|
31
29
|
super(scope, id, {
|
|
32
|
-
buildCommand: "npx --yes open-next
|
|
30
|
+
buildCommand: "npx --yes open-next@1.4.0 build",
|
|
33
31
|
...props,
|
|
34
32
|
});
|
|
35
33
|
this.createWarmer();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Construct } from "constructs";
|
|
2
|
+
import { RetentionDays } from "aws-cdk-lib/aws-logs";
|
|
2
3
|
import { FunctionOptions, Function as CdkFunction } from "aws-cdk-lib/aws-lambda";
|
|
3
4
|
import { NodeJSProps, FunctionCopyFilesProps } from "./Function.js";
|
|
4
5
|
import { SSTConstruct } from "./Construct.js";
|
|
@@ -16,6 +17,7 @@ export interface SsrFunctionProps extends Omit<FunctionOptions, "memorySize" | "
|
|
|
16
17
|
bind?: SSTConstruct[];
|
|
17
18
|
nodejs?: NodeJSProps;
|
|
18
19
|
copyFiles?: FunctionCopyFilesProps[];
|
|
20
|
+
logRetention?: RetentionDays;
|
|
19
21
|
}
|
|
20
22
|
export declare class SsrFunction extends Construct {
|
|
21
23
|
function: CdkFunction;
|
|
@@ -69,11 +69,11 @@ export class SsrFunction extends Construct {
|
|
|
69
69
|
attachPermissionsToRole(this.function.role, permissions);
|
|
70
70
|
}
|
|
71
71
|
createFunction(assetBucket, assetKey) {
|
|
72
|
-
const { runtime, timeout, memorySize, handler } = this.props;
|
|
72
|
+
const { runtime, timeout, memorySize, handler, logRetention } = this.props;
|
|
73
73
|
return new CdkFunction(this, `ServerFunction`, {
|
|
74
74
|
...this.props,
|
|
75
75
|
handler: handler.split(path.sep).join(path.posix.sep),
|
|
76
|
-
logRetention: RetentionDays.THREE_DAYS,
|
|
76
|
+
logRetention: logRetention ?? RetentionDays.THREE_DAYS,
|
|
77
77
|
code: Code.fromBucket(Bucket.fromBucketName(this, "IServerFunctionBucket", assetBucket), assetKey),
|
|
78
78
|
runtime: runtime === "nodejs14.x"
|
|
79
79
|
? Runtime.NODEJS_14_X
|
|
@@ -87,6 +87,7 @@ export class SsrFunction extends Construct {
|
|
|
87
87
|
timeout: typeof timeout === "string"
|
|
88
88
|
? toCdkDuration(timeout)
|
|
89
89
|
: CdkDuration.seconds(timeout),
|
|
90
|
+
logRetentionRetryOptions: logRetention && { maxRetries: 100 },
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
93
|
createCodeReplacer(assetBucket, assetKey) {
|
package/constructs/SsrSite.d.ts
CHANGED
|
@@ -188,7 +188,7 @@ export interface SsrSiteProps {
|
|
|
188
188
|
* from the server rendering Lambda.
|
|
189
189
|
*/
|
|
190
190
|
responseHeadersPolicy?: IResponseHeadersPolicy;
|
|
191
|
-
server?: Pick<FunctionProps, "vpc" | "vpcSubnets" | "securityGroups" | "allowAllOutbound" | "allowPublicSubnet" | "architecture">;
|
|
191
|
+
server?: Pick<FunctionProps, "vpc" | "vpcSubnets" | "securityGroups" | "allowAllOutbound" | "allowPublicSubnet" | "architecture" | "logRetention">;
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
type SsrSiteNormalizedProps = SsrSiteProps & {
|