sst 2.35.1 → 2.36.1
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/local/server.js +1 -0
- package/constructs/App.js +6 -3
- package/constructs/Function.d.ts +2 -0
- package/constructs/Function.js +3 -0
- package/constructs/NextjsSite.d.ts +8 -7
- package/constructs/NextjsSite.js +26 -12
- package/constructs/SsrFunction.d.ts +3 -0
- package/constructs/SsrFunction.js +6 -0
- package/package.json +2 -2
package/cli/local/server.js
CHANGED
package/constructs/App.js
CHANGED
|
@@ -241,14 +241,17 @@ export class App extends CDKApp {
|
|
|
241
241
|
this.isFinished = true;
|
|
242
242
|
const { config, paths } = useProject();
|
|
243
243
|
Auth.injectConfig();
|
|
244
|
-
this.buildConstructsMetadata();
|
|
245
244
|
this.ensureUniqueConstructIds();
|
|
246
245
|
// Run deferred tasks
|
|
247
|
-
// -
|
|
246
|
+
// - After codegen b/c some frontend frameworks (ie. Next.js apps) runs
|
|
248
247
|
// type checking in the build step
|
|
249
|
-
// -
|
|
248
|
+
// - Before remove govcloud unsupported resource properties b/c deferred
|
|
250
249
|
// tasks may add govcloud unsupported resource properties
|
|
251
250
|
await useDeferredTasks().run();
|
|
251
|
+
// Build constructs metadata after running deferred tasks
|
|
252
|
+
// - Metadata for Functions needs to know if sourcemaps are enabled, which
|
|
253
|
+
// is not known until after build
|
|
254
|
+
this.buildConstructsMetadata();
|
|
252
255
|
this.createBindingSsmParameters();
|
|
253
256
|
this.removeGovCloudUnsupportedResourceProperties();
|
|
254
257
|
useWarning().print();
|
package/constructs/Function.d.ts
CHANGED
|
@@ -671,6 +671,7 @@ export declare class Function extends CDKFunction implements SSTConstruct {
|
|
|
671
671
|
readonly _isLiveDevEnabled: boolean;
|
|
672
672
|
/** @internal */
|
|
673
673
|
readonly _doNotAllowOthersToBind?: boolean;
|
|
674
|
+
private missingSourcemap?;
|
|
674
675
|
private functionUrl?;
|
|
675
676
|
private props;
|
|
676
677
|
private allBindings;
|
|
@@ -704,6 +705,7 @@ export declare class Function extends CDKFunction implements SSTConstruct {
|
|
|
704
705
|
arn: string;
|
|
705
706
|
runtime: "container" | "rust" | "nodejs14.x" | "nodejs16.x" | "nodejs18.x" | "python3.7" | "python3.8" | "python3.9" | "python3.10" | "python3.11" | "dotnetcore3.1" | "dotnet6" | "java8" | "java11" | "java17" | "go1.x" | "go" | undefined;
|
|
706
707
|
handler: string | undefined;
|
|
708
|
+
missingSourcemap: boolean | undefined;
|
|
707
709
|
localId: string;
|
|
708
710
|
secrets: string[];
|
|
709
711
|
};
|
package/constructs/Function.js
CHANGED
|
@@ -65,6 +65,7 @@ export class Function extends CDKFunction {
|
|
|
65
65
|
_isLiveDevEnabled;
|
|
66
66
|
/** @internal */
|
|
67
67
|
_doNotAllowOthersToBind;
|
|
68
|
+
missingSourcemap;
|
|
68
69
|
functionUrl;
|
|
69
70
|
props;
|
|
70
71
|
allBindings = [];
|
|
@@ -261,6 +262,7 @@ export class Function extends CDKFunction {
|
|
|
261
262
|
tarKey: this.functionArn,
|
|
262
263
|
});
|
|
263
264
|
}
|
|
265
|
+
this.missingSourcemap = !result.sourcemap;
|
|
264
266
|
// Update code
|
|
265
267
|
const cfnFunction = this.node.defaultChild;
|
|
266
268
|
const code = AssetCode.fromAsset(result.out);
|
|
@@ -369,6 +371,7 @@ export class Function extends CDKFunction {
|
|
|
369
371
|
arn: this.functionArn,
|
|
370
372
|
runtime: this.props.runtime,
|
|
371
373
|
handler: this.props.handler,
|
|
374
|
+
missingSourcemap: this.missingSourcemap === true ? true : undefined,
|
|
372
375
|
localId: this.node.addr,
|
|
373
376
|
secrets: this.allBindings
|
|
374
377
|
.filter((c) => c instanceof Secret)
|
|
@@ -21,10 +21,10 @@ export interface NextjsSiteProps extends Omit<SsrSiteProps, "nodejs"> {
|
|
|
21
21
|
* How the logs are stored in CloudWatch
|
|
22
22
|
* - "combined" - Logs from all routes are stored in the same log group.
|
|
23
23
|
* - "per-route" - Logs from each route are stored in a separate log group.
|
|
24
|
-
* @default "
|
|
24
|
+
* @default "per-route"
|
|
25
25
|
* @example
|
|
26
26
|
* ```js
|
|
27
|
-
* logging: "
|
|
27
|
+
* logging: "combined",
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
logging?: "combined" | "per-route";
|
|
@@ -134,7 +134,7 @@ export declare class NextjsSite extends SsrSite {
|
|
|
134
134
|
private appPathsManifest?;
|
|
135
135
|
private pagesManifest?;
|
|
136
136
|
private prerenderManifest?;
|
|
137
|
-
constructor(scope: Construct, id: string,
|
|
137
|
+
constructor(scope: Construct, id: string, rawProps?: NextjsSiteProps);
|
|
138
138
|
static buildDefaultServerCachePolicyProps(): CachePolicyProps;
|
|
139
139
|
protected plan(bucket: Bucket): {
|
|
140
140
|
cloudFrontFunctions?: {
|
|
@@ -205,10 +205,10 @@ export declare class NextjsSite extends SsrSite {
|
|
|
205
205
|
* How the logs are stored in CloudWatch
|
|
206
206
|
* - "combined" - Logs from all routes are stored in the same log group.
|
|
207
207
|
* - "per-route" - Logs from each route are stored in a separate log group.
|
|
208
|
-
* @default "
|
|
208
|
+
* @default "per-route"
|
|
209
209
|
* @example
|
|
210
210
|
* ```js
|
|
211
|
-
* logging: "
|
|
211
|
+
* logging: "combined",
|
|
212
212
|
* ```
|
|
213
213
|
*/
|
|
214
214
|
environment?: Record<string, string> | undefined;
|
|
@@ -312,10 +312,10 @@ export declare class NextjsSite extends SsrSite {
|
|
|
312
312
|
* How the logs are stored in CloudWatch
|
|
313
313
|
* - "combined" - Logs from all routes are stored in the same log group.
|
|
314
314
|
* - "per-route" - Logs from each route are stored in a separate log group.
|
|
315
|
-
* @default "
|
|
315
|
+
* @default "per-route"
|
|
316
316
|
* @example
|
|
317
317
|
* ```js
|
|
318
|
-
* logging: "
|
|
318
|
+
* logging: "combined",
|
|
319
319
|
* ```
|
|
320
320
|
*/
|
|
321
321
|
environment?: Record<string, string> | undefined;
|
|
@@ -377,6 +377,7 @@ export declare class NextjsSite extends SsrSite {
|
|
|
377
377
|
private getSourcemapForAppRoute;
|
|
378
378
|
private getSourcemapForPagesRoute;
|
|
379
379
|
private isPerRouteLoggingEnabled;
|
|
380
|
+
private handleMissingSourcemap;
|
|
380
381
|
private disableDefaultLogging;
|
|
381
382
|
private uploadSourcemaps;
|
|
382
383
|
private static buildCloudWatchRouteName;
|
package/constructs/NextjsSite.js
CHANGED
|
@@ -20,7 +20,7 @@ import { useFunctions } from "./Function.js";
|
|
|
20
20
|
import { useDeferredTasks } from "./deferred_task.js";
|
|
21
21
|
import { Logger } from "../logger.js";
|
|
22
22
|
const LAYER_VERSION = "2";
|
|
23
|
-
const DEFAULT_OPEN_NEXT_VERSION = "2.3.
|
|
23
|
+
const DEFAULT_OPEN_NEXT_VERSION = "2.3.1";
|
|
24
24
|
const DEFAULT_CACHE_POLICY_ALLOWED_HEADERS = [
|
|
25
25
|
"accept",
|
|
26
26
|
"rsc",
|
|
@@ -46,33 +46,41 @@ export class NextjsSite extends SsrSite {
|
|
|
46
46
|
appPathsManifest;
|
|
47
47
|
pagesManifest;
|
|
48
48
|
prerenderManifest;
|
|
49
|
-
constructor(scope, id,
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
constructor(scope, id, rawProps) {
|
|
50
|
+
const props = {
|
|
51
|
+
logging: rawProps?.logging ?? "per-route",
|
|
52
|
+
experimental: {
|
|
53
|
+
streaming: rawProps?.experimental?.streaming ?? false,
|
|
54
|
+
disableDynamoDBCache: rawProps?.experimental?.disableDynamoDBCache ?? false,
|
|
55
|
+
disableIncrementalCache: rawProps?.experimental?.disableIncrementalCache ?? false,
|
|
56
|
+
...rawProps?.experimental,
|
|
57
|
+
},
|
|
58
|
+
...rawProps,
|
|
59
|
+
};
|
|
53
60
|
super(scope, id, {
|
|
54
61
|
buildCommand: [
|
|
55
62
|
"npx",
|
|
56
63
|
"--yes",
|
|
57
64
|
`open-next@${props?.openNextVersion ?? DEFAULT_OPEN_NEXT_VERSION}`,
|
|
58
65
|
"build",
|
|
59
|
-
...(streaming ? ["--streaming"] : []),
|
|
60
|
-
...(disableDynamoDBCache
|
|
66
|
+
...(props.experimental.streaming ? ["--streaming"] : []),
|
|
67
|
+
...(props.experimental.disableDynamoDBCache
|
|
61
68
|
? ["--dangerously-disable-dynamodb-cache"]
|
|
62
69
|
: []),
|
|
63
|
-
...(disableIncrementalCache
|
|
70
|
+
...(props.experimental.disableIncrementalCache
|
|
64
71
|
? ["--dangerously-disable-incremental-cache"]
|
|
65
72
|
: []),
|
|
66
73
|
].join(" "),
|
|
67
74
|
...props,
|
|
68
75
|
});
|
|
76
|
+
this.handleMissingSourcemap();
|
|
69
77
|
if (this.isPerRouteLoggingEnabled()) {
|
|
70
78
|
this.disableDefaultLogging();
|
|
71
79
|
this.uploadSourcemaps();
|
|
72
80
|
}
|
|
73
|
-
if (!disableIncrementalCache) {
|
|
81
|
+
if (!props.experimental.disableIncrementalCache) {
|
|
74
82
|
this.createRevalidationQueue();
|
|
75
|
-
if (!disableDynamoDBCache) {
|
|
83
|
+
if (!props.experimental.disableDynamoDBCache) {
|
|
76
84
|
this.createRevalidationTable();
|
|
77
85
|
}
|
|
78
86
|
}
|
|
@@ -563,9 +571,15 @@ export class NextjsSite extends SsrSite {
|
|
|
563
571
|
!this.props.edge &&
|
|
564
572
|
this.props.logging === "per-route");
|
|
565
573
|
}
|
|
574
|
+
handleMissingSourcemap() {
|
|
575
|
+
if (this.doNotDeploy || this.props.edge)
|
|
576
|
+
return;
|
|
577
|
+
const hasMissingSourcemap = this.useRoutes().every(({ sourcemapPath, sourcemapKey }) => !sourcemapPath || !sourcemapKey);
|
|
578
|
+
if (!hasMissingSourcemap)
|
|
579
|
+
return;
|
|
580
|
+
this.serverFunction._overrideMissingSourcemap();
|
|
581
|
+
}
|
|
566
582
|
disableDefaultLogging() {
|
|
567
|
-
// Note: keep default logs enabled
|
|
568
|
-
return;
|
|
569
583
|
const stack = Stack.of(this);
|
|
570
584
|
const server = this.serverFunction;
|
|
571
585
|
const policy = new Policy(this, "DisableLoggingPolicy", {
|
|
@@ -27,6 +27,7 @@ export declare class SsrFunction extends Construct implements SSTConstruct {
|
|
|
27
27
|
function: CdkFunction;
|
|
28
28
|
private assetReplacer;
|
|
29
29
|
private assetReplacerPolicy;
|
|
30
|
+
private missingSourcemap?;
|
|
30
31
|
private props;
|
|
31
32
|
constructor(scope: Construct, id: string, props: SsrFunctionProps);
|
|
32
33
|
get role(): import("aws-cdk-lib/aws-iam").IRole | undefined;
|
|
@@ -36,6 +37,7 @@ export declare class SsrFunction extends Construct implements SSTConstruct {
|
|
|
36
37
|
addFunctionUrl(props?: FunctionUrlOptions): import("aws-cdk-lib/aws-lambda").FunctionUrl;
|
|
37
38
|
grantInvoke(grantee: IGrantable): import("aws-cdk-lib/aws-iam").Grant;
|
|
38
39
|
attachPermissions(permissions: Permissions): void;
|
|
40
|
+
_overrideMissingSourcemap(): void;
|
|
39
41
|
private createFunction;
|
|
40
42
|
private createCodeReplacer;
|
|
41
43
|
private bind;
|
|
@@ -50,6 +52,7 @@ export declare class SsrFunction extends Construct implements SSTConstruct {
|
|
|
50
52
|
arn: string;
|
|
51
53
|
runtime: "nodejs14.x" | "nodejs16.x" | "nodejs18.x" | undefined;
|
|
52
54
|
handler: string;
|
|
55
|
+
missingSourcemap: boolean | undefined;
|
|
53
56
|
localId: string;
|
|
54
57
|
secrets: string[];
|
|
55
58
|
};
|
|
@@ -30,6 +30,7 @@ export class SsrFunction extends Construct {
|
|
|
30
30
|
function;
|
|
31
31
|
assetReplacer;
|
|
32
32
|
assetReplacerPolicy;
|
|
33
|
+
missingSourcemap;
|
|
33
34
|
props;
|
|
34
35
|
constructor(scope, id, props) {
|
|
35
36
|
super(scope, id);
|
|
@@ -86,6 +87,9 @@ export class SsrFunction extends Construct {
|
|
|
86
87
|
attachPermissions(permissions) {
|
|
87
88
|
attachPermissionsToRole(this.function.role, permissions);
|
|
88
89
|
}
|
|
90
|
+
_overrideMissingSourcemap() {
|
|
91
|
+
this.missingSourcemap = true;
|
|
92
|
+
}
|
|
89
93
|
createFunction(assetBucket, assetKey) {
|
|
90
94
|
const { architecture, runtime, timeout, memorySize, handler, logRetention, } = this.props;
|
|
91
95
|
return new CdkFunction(this, `ServerFunction`, {
|
|
@@ -196,6 +200,7 @@ export class SsrFunction extends Construct {
|
|
|
196
200
|
tarKey: this.functionArn,
|
|
197
201
|
});
|
|
198
202
|
}
|
|
203
|
+
this.missingSourcemap = !result.sourcemap;
|
|
199
204
|
return AssetCode.fromAsset(result.out);
|
|
200
205
|
}
|
|
201
206
|
async buildAssetFromBundle(bundle) {
|
|
@@ -237,6 +242,7 @@ export class SsrFunction extends Construct {
|
|
|
237
242
|
arn: this.functionArn,
|
|
238
243
|
runtime: this.props.runtime,
|
|
239
244
|
handler: this.props.handler,
|
|
245
|
+
missingSourcemap: this.missingSourcemap === true ? true : undefined,
|
|
240
246
|
localId: this.node.addr,
|
|
241
247
|
secrets: [],
|
|
242
248
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "sst",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.36.1",
|
|
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.
|
|
123
|
+
"astro-sst": "2.36.1",
|
|
124
124
|
"async": "^3.2.4",
|
|
125
125
|
"tsx": "^3.12.1",
|
|
126
126
|
"typescript": "^5.2.2",
|