sst 2.16.3 → 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.
|
@@ -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.
|
package/constructs/NextjsSite.js
CHANGED
|
@@ -40,6 +40,7 @@ export class NextjsSite extends SsrSite {
|
|
|
40
40
|
createRevalidation() {
|
|
41
41
|
if (!this.serverLambdaForRegional && !this.serverLambdaForEdge)
|
|
42
42
|
return;
|
|
43
|
+
const { cdk } = this.props;
|
|
43
44
|
const queue = new Queue(this, "RevalidationQueue", {
|
|
44
45
|
fifo: true,
|
|
45
46
|
receiveMessageWaitTime: CdkDuration.seconds(20),
|
|
@@ -50,6 +51,7 @@ export class NextjsSite extends SsrSite {
|
|
|
50
51
|
code: Code.fromAsset(path.join(this.props.path, ".open-next", "revalidation-function")),
|
|
51
52
|
runtime: Runtime.NODEJS_18_X,
|
|
52
53
|
timeout: CdkDuration.seconds(30),
|
|
54
|
+
...cdk?.revalidation,
|
|
53
55
|
});
|
|
54
56
|
consumer.addEventSource(new SqsEventSource(queue, { batchSize: 5 }));
|
|
55
57
|
// Allow server to send messages to the queue
|