sst 2.39.8 → 2.39.10
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/bootstrap.js +1 -1
- package/constructs/AstroSite.d.ts +0 -4
- package/constructs/Job.d.ts +2 -2
- package/constructs/Job.js +15 -3
- package/constructs/NextjsSite.d.ts +13 -4
- package/constructs/NextjsSite.js +3 -3
- package/constructs/RemixSite.d.ts +0 -4
- package/constructs/SolidStartSite.d.ts +0 -4
- package/constructs/SsrFunction.js +2 -2
- package/constructs/SsrSite.d.ts +3 -9
- package/constructs/SsrSite.js +21 -13
- package/constructs/SvelteKitSite.d.ts +0 -4
- package/package.json +2 -2
package/bootstrap.js
CHANGED
|
@@ -20,7 +20,7 @@ const CDK_STACK_NAME = "CDKToolkit";
|
|
|
20
20
|
const SST_STACK_NAME = "SSTBootstrap";
|
|
21
21
|
const OUTPUT_VERSION = "Version";
|
|
22
22
|
const OUTPUT_BUCKET = "BucketName";
|
|
23
|
-
const LATEST_VERSION = "7.
|
|
23
|
+
const LATEST_VERSION = "7.3";
|
|
24
24
|
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
25
25
|
export const useBootstrap = lazy(async () => {
|
|
26
26
|
Logger.debug("Initializing bootstrap context");
|
|
@@ -64,10 +64,6 @@ export declare class AstroSite extends SsrSite {
|
|
|
64
64
|
allowedHeaders?: string[] | undefined;
|
|
65
65
|
} | undefined;
|
|
66
66
|
buildId?: string | undefined;
|
|
67
|
-
warmerConfig?: {
|
|
68
|
-
function: string;
|
|
69
|
-
schedule?: import("aws-cdk-lib/aws-events").Schedule | undefined;
|
|
70
|
-
} | undefined;
|
|
71
67
|
};
|
|
72
68
|
getConstructMetadata(): {
|
|
73
69
|
data: {
|
package/constructs/Job.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export interface JobProps {
|
|
|
61
61
|
architecture?: "x86_64" | "arm_64";
|
|
62
62
|
/**
|
|
63
63
|
* The runtime environment for the job.
|
|
64
|
-
* @default "
|
|
64
|
+
* @default "nodejs18.x"
|
|
65
65
|
* @example
|
|
66
66
|
* ```js
|
|
67
67
|
* new Job(stack, "MyJob", {
|
|
@@ -70,7 +70,7 @@ export interface JobProps {
|
|
|
70
70
|
* })
|
|
71
71
|
*```
|
|
72
72
|
*/
|
|
73
|
-
runtime?: "nodejs" | "container";
|
|
73
|
+
runtime?: "nodejs" | "nodejs16.x" | "nodejs18.x" | "nodejs20.x" | "container";
|
|
74
74
|
/**
|
|
75
75
|
* For "nodejs" runtime, point to the entry point and handler function.
|
|
76
76
|
* Of the format: `/path/to/file.function`.
|
package/constructs/Job.js
CHANGED
|
@@ -275,11 +275,23 @@ export class Job extends Construct {
|
|
|
275
275
|
const code = AssetCode.fromAsset(result.out);
|
|
276
276
|
const codeConfig = code.bind(this);
|
|
277
277
|
const project = this.job.node.defaultChild;
|
|
278
|
+
const dockerImageMap = {
|
|
279
|
+
arm_64: {
|
|
280
|
+
nodejs: "amazon/aws-lambda-nodejs:16.2023.07.13.14",
|
|
281
|
+
"nodejs16.x": "amazon/aws-lambda-nodejs:16.2023.07.13.14",
|
|
282
|
+
"nodejs18.x": "amazon/aws-lambda-nodejs:18.2023.12.14.13",
|
|
283
|
+
"nodejs20.x": "amazon/aws-lambda-nodejs:20.2023.12.14.13",
|
|
284
|
+
},
|
|
285
|
+
x86_64: {
|
|
286
|
+
nodejs: "amazon/aws-lambda-nodejs:16",
|
|
287
|
+
"nodejs16.x": "amazon/aws-lambda-nodejs:16",
|
|
288
|
+
"nodejs18.x": "amazon/aws-lambda-nodejs:18",
|
|
289
|
+
"nodejs20.x": "amazon/aws-lambda-nodejs:20",
|
|
290
|
+
},
|
|
291
|
+
};
|
|
278
292
|
const image = LinuxBuildImage.fromDockerRegistry(
|
|
279
293
|
// ARM images can be found here https://hub.docker.com/r/amazon/aws-lambda-nodejs
|
|
280
|
-
architecture
|
|
281
|
-
? "amazon/aws-lambda-nodejs:16.2023.07.13.14"
|
|
282
|
-
: "amazon/aws-lambda-nodejs:16");
|
|
294
|
+
dockerImageMap[architecture ?? "x86_64"][runtime ?? "nodejs18.x"]);
|
|
283
295
|
project.environment = {
|
|
284
296
|
...project.environment,
|
|
285
297
|
type: architecture === "arm_64" ? "ARM_CONTAINER" : "LINUX_CONTAINER",
|
|
@@ -43,6 +43,19 @@ export interface NextjsSiteProps extends Omit<SsrSiteProps, "nodejs"> {
|
|
|
43
43
|
*/
|
|
44
44
|
memorySize?: number | Size;
|
|
45
45
|
};
|
|
46
|
+
openNext?: {
|
|
47
|
+
/**
|
|
48
|
+
* Specify a custom build output path for cases when running OpenNext from
|
|
49
|
+
* a monorepo with decentralized build output. This is passed to the
|
|
50
|
+
* `--build-output-path` flag of OpenNext.
|
|
51
|
+
* @default Default build output path
|
|
52
|
+
* @example
|
|
53
|
+
* ```js
|
|
54
|
+
* buildOutputPath: "dist/apps/example-app"
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
buildOutputPath?: string;
|
|
58
|
+
};
|
|
46
59
|
experimental?: {
|
|
47
60
|
/**
|
|
48
61
|
* Enable streaming. Currently an experimental feature in OpenNext.
|
|
@@ -221,10 +234,6 @@ export declare class NextjsSite extends SsrSite {
|
|
|
221
234
|
allowedHeaders?: string[] | undefined;
|
|
222
235
|
} | undefined;
|
|
223
236
|
buildId?: string | undefined;
|
|
224
|
-
warmerConfig?: {
|
|
225
|
-
function: string;
|
|
226
|
-
schedule?: import("aws-cdk-lib/aws-events").Schedule | undefined;
|
|
227
|
-
} | undefined;
|
|
228
237
|
};
|
|
229
238
|
private createRevalidationQueue;
|
|
230
239
|
private createRevalidationTable;
|
package/constructs/NextjsSite.js
CHANGED
|
@@ -63,6 +63,9 @@ export class NextjsSite extends SsrSite {
|
|
|
63
63
|
"--yes",
|
|
64
64
|
`open-next@${props?.openNextVersion ?? DEFAULT_OPEN_NEXT_VERSION}`,
|
|
65
65
|
"build",
|
|
66
|
+
...(props.openNext?.buildOutputPath
|
|
67
|
+
? ["--build-output-path", props.openNext.buildOutputPath]
|
|
68
|
+
: []),
|
|
66
69
|
...(props.experimental.streaming ? ["--streaming"] : []),
|
|
67
70
|
...(props.experimental.disableDynamoDBCache
|
|
68
71
|
? ["--dangerously-disable-dynamodb-cache"]
|
|
@@ -237,9 +240,6 @@ export class NextjsSite extends SsrSite {
|
|
|
237
240
|
allowedHeaders: DEFAULT_CACHE_POLICY_ALLOWED_HEADERS,
|
|
238
241
|
},
|
|
239
242
|
buildId: this.getBuildId(),
|
|
240
|
-
warmerConfig: {
|
|
241
|
-
function: path.join(sitePath, ".open-next", "warmer-function"),
|
|
242
|
-
},
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
245
|
createRevalidationQueue() {
|
|
@@ -90,10 +90,6 @@ export declare class RemixSite extends SsrSite {
|
|
|
90
90
|
allowedHeaders?: string[] | undefined;
|
|
91
91
|
} | undefined;
|
|
92
92
|
buildId?: string | undefined;
|
|
93
|
-
warmerConfig?: {
|
|
94
|
-
function: string;
|
|
95
|
-
schedule?: import("aws-cdk-lib/aws-events").Schedule | undefined;
|
|
96
|
-
} | undefined;
|
|
97
93
|
};
|
|
98
94
|
protected getServerModuleFormat(): "cjs" | "esm";
|
|
99
95
|
private createServerLambdaBundle;
|
|
@@ -72,10 +72,6 @@ export declare class SolidStartSite extends SsrSite {
|
|
|
72
72
|
allowedHeaders?: string[] | undefined;
|
|
73
73
|
} | undefined;
|
|
74
74
|
buildId?: string | undefined;
|
|
75
|
-
warmerConfig?: {
|
|
76
|
-
function: string;
|
|
77
|
-
schedule?: import("aws-cdk-lib/aws-events").Schedule | undefined;
|
|
78
|
-
} | undefined;
|
|
79
75
|
};
|
|
80
76
|
getConstructMetadata(): {
|
|
81
77
|
data: {
|
|
@@ -274,10 +274,10 @@ export class SsrFunction extends Construct {
|
|
|
274
274
|
const newHandlerFunction = "handler";
|
|
275
275
|
await fs.writeFile(path.join(bundle, handlerDir, `${newHandlerName}.mjs`), streaming
|
|
276
276
|
? [
|
|
277
|
-
`export const ${newHandlerFunction} = awslambda.streamifyResponse(async (event, context) => {`,
|
|
277
|
+
`export const ${newHandlerFunction} = awslambda.streamifyResponse(async (event, responseStream, context) => {`,
|
|
278
278
|
...injections,
|
|
279
279
|
` const { ${oldHandlerFunction}: rawHandler} = await import("./${oldHandlerName}.mjs");`,
|
|
280
|
-
` return rawHandler(event,
|
|
280
|
+
` return rawHandler(event, responseStream);`,
|
|
281
281
|
`});`,
|
|
282
282
|
].join("\n")
|
|
283
283
|
: [
|
package/constructs/SsrSite.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { Bucket, BucketProps, IBucket } from "aws-cdk-lib/aws-s3";
|
|
|
3
3
|
import { Function as CdkFunction, FunctionProps as CdkFunctionProps } from "aws-cdk-lib/aws-lambda";
|
|
4
4
|
import { ICachePolicy, IResponseHeadersPolicy, ViewerProtocolPolicy, AllowedMethods, CachePolicyProps, ErrorResponse } from "aws-cdk-lib/aws-cloudfront";
|
|
5
5
|
import { S3OriginProps } from "aws-cdk-lib/aws-cloudfront-origins";
|
|
6
|
-
import { Schedule } from "aws-cdk-lib/aws-events";
|
|
7
6
|
import { DistributionDomainProps } from "./Distribution.js";
|
|
8
7
|
import { SSTConstruct } from "./Construct.js";
|
|
9
8
|
import { NodeJSProps, FunctionProps } from "./Function.js";
|
|
@@ -391,6 +390,9 @@ export interface SsrSiteProps {
|
|
|
391
390
|
*/
|
|
392
391
|
viewerProtocolPolicy?: ViewerProtocolPolicy;
|
|
393
392
|
server?: Pick<CdkFunctionProps, "layers" | "vpc" | "vpcSubnets" | "securityGroups" | "allowAllOutbound" | "allowPublicSubnet" | "architecture" | "logRetention"> & Pick<FunctionProps, "copyFiles">;
|
|
393
|
+
/**
|
|
394
|
+
* @hidden Need to fix tsdoc generation to support the `Plan` type
|
|
395
|
+
*/
|
|
394
396
|
transform?: (args: Plan) => void;
|
|
395
397
|
};
|
|
396
398
|
}
|
|
@@ -493,10 +495,6 @@ export declare abstract class SsrSite extends Construct implements SSTConstruct
|
|
|
493
495
|
allowedHeaders?: string[];
|
|
494
496
|
};
|
|
495
497
|
buildId?: string;
|
|
496
|
-
warmerConfig?: {
|
|
497
|
-
function: string;
|
|
498
|
-
schedule?: Schedule;
|
|
499
|
-
};
|
|
500
498
|
}): {
|
|
501
499
|
cloudFrontFunctions?: CloudFrontFunctions | undefined;
|
|
502
500
|
edgeFunctions?: EdgeFunctions | undefined;
|
|
@@ -515,10 +513,6 @@ export declare abstract class SsrSite extends Construct implements SSTConstruct
|
|
|
515
513
|
allowedHeaders?: string[] | undefined;
|
|
516
514
|
} | undefined;
|
|
517
515
|
buildId?: string | undefined;
|
|
518
|
-
warmerConfig?: {
|
|
519
|
-
function: string;
|
|
520
|
-
schedule?: Schedule | undefined;
|
|
521
|
-
} | undefined;
|
|
522
516
|
};
|
|
523
517
|
}
|
|
524
518
|
export declare const useSites: () => {
|
package/constructs/SsrSite.js
CHANGED
|
@@ -223,8 +223,7 @@ export class SsrSite extends Construct {
|
|
|
223
223
|
// Create warmer function
|
|
224
224
|
const warmer = new CdkFunction(self, "WarmerFunction", {
|
|
225
225
|
description: "SSR warmer",
|
|
226
|
-
code: Code.fromAsset(
|
|
227
|
-
path.join(__dirname, "../support/ssr-warmer")),
|
|
226
|
+
code: Code.fromAsset(path.join(__dirname, "../support/ssr-warmer")),
|
|
228
227
|
runtime: Runtime.NODEJS_18_X,
|
|
229
228
|
handler: "index.handler",
|
|
230
229
|
timeout: CdkDuration.minutes(15),
|
|
@@ -237,7 +236,7 @@ export class SsrSite extends Construct {
|
|
|
237
236
|
ssrFunctions[0].grantInvoke(warmer);
|
|
238
237
|
// Create cron job
|
|
239
238
|
new Rule(self, "WarmerRule", {
|
|
240
|
-
schedule:
|
|
239
|
+
schedule: Schedule.rate(CdkDuration.minutes(5)),
|
|
241
240
|
targets: [new LambdaFunction(warmer, { retryAttempts: 0 })],
|
|
242
241
|
});
|
|
243
242
|
// Create custom resource to prewarm on deploy
|
|
@@ -456,7 +455,7 @@ function handler(event) {
|
|
|
456
455
|
...cdk?.server,
|
|
457
456
|
streaming: props.streaming,
|
|
458
457
|
injections: [
|
|
459
|
-
...(warm ? [useServerFunctionWarmingInjection()] : []),
|
|
458
|
+
...(warm ? [useServerFunctionWarmingInjection(props.streaming)] : []),
|
|
460
459
|
...(props.injections || []),
|
|
461
460
|
],
|
|
462
461
|
prefetchSecrets: regional?.prefetchSecrets,
|
|
@@ -649,15 +648,24 @@ function handler(event) {
|
|
|
649
648
|
OriginRequestPolicy.fromOriginRequestPolicyId(self, "ServerOriginRequestPolicy", "b689b0a8-53d0-40ab-baf2-68738e2966ac");
|
|
650
649
|
return singletonOriginRequestPolicy;
|
|
651
650
|
}
|
|
652
|
-
function useServerFunctionWarmingInjection() {
|
|
653
|
-
return
|
|
654
|
-
if (event.type === "warmer") {
|
|
655
|
-
|
|
656
|
-
setTimeout(() => {
|
|
657
|
-
resolve({ serverId: "server-" + Math.random().toString(36).slice(2, 8) })
|
|
658
|
-
}, event.delay)
|
|
659
|
-
})
|
|
660
|
-
|
|
651
|
+
function useServerFunctionWarmingInjection(streaming) {
|
|
652
|
+
return [
|
|
653
|
+
`if (event.type === "warmer") {`,
|
|
654
|
+
` const p = new Promise((resolve) => {`,
|
|
655
|
+
` setTimeout(() => {`,
|
|
656
|
+
` resolve({ serverId: "server-" + Math.random().toString(36).slice(2, 8) });`,
|
|
657
|
+
` }, event.delay);`,
|
|
658
|
+
` });`,
|
|
659
|
+
...(streaming
|
|
660
|
+
? [
|
|
661
|
+
` const response = await p;`,
|
|
662
|
+
` responseStream.write(JSON.stringify(response));`,
|
|
663
|
+
` responseStream.end();`,
|
|
664
|
+
` return;`,
|
|
665
|
+
]
|
|
666
|
+
: [` return p;`]),
|
|
667
|
+
`}`,
|
|
668
|
+
].join("\n");
|
|
661
669
|
}
|
|
662
670
|
function getS3FileOptions(copy) {
|
|
663
671
|
const fileOptions = [];
|
|
@@ -103,10 +103,6 @@ export declare class SvelteKitSite extends SsrSite {
|
|
|
103
103
|
allowedHeaders?: string[] | undefined;
|
|
104
104
|
} | undefined;
|
|
105
105
|
buildId?: string | undefined;
|
|
106
|
-
warmerConfig?: {
|
|
107
|
-
function: string;
|
|
108
|
-
schedule?: import("aws-cdk-lib/aws-events").Schedule | undefined;
|
|
109
|
-
} | undefined;
|
|
110
106
|
};
|
|
111
107
|
getConstructMetadata(): {
|
|
112
108
|
data: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "sst",
|
|
4
|
-
"version": "2.39.
|
|
4
|
+
"version": "2.39.10",
|
|
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.39.
|
|
123
|
+
"astro-sst": "2.39.10",
|
|
124
124
|
"async": "^3.2.4",
|
|
125
125
|
"tsx": "^3.12.1",
|
|
126
126
|
"typescript": "^5.2.2",
|