sst 2.0.0-rc.62 → 2.0.0-rc.64
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/AppSyncApi.d.ts +1 -1
- package/constructs/AppSyncApi.js +4 -1
- package/constructs/AstroSite.d.ts +2 -2
- package/constructs/AstroSite.js +4 -2
- package/constructs/NextjsSite.js +5 -5
- package/constructs/SolidStartSite.d.ts +2 -2
- package/constructs/SolidStartSite.js +4 -4
- package/constructs/SsrFunction.d.ts +2 -3
- package/constructs/SsrFunction.js +2 -3
- package/constructs/SsrSite.d.ts +1 -1
- package/package.json +2 -1
|
@@ -245,7 +245,7 @@ export interface AppSyncApiProps {
|
|
|
245
245
|
* });
|
|
246
246
|
* ```
|
|
247
247
|
*/
|
|
248
|
-
schema
|
|
248
|
+
schema?: string | string[];
|
|
249
249
|
/**
|
|
250
250
|
* Specify a custom domain to use in addition to the automatically generated one. SST currently supports domains that are configured using [Route 53](https://aws.amazon.com/route53/)
|
|
251
251
|
*
|
package/constructs/AppSyncApi.js
CHANGED
|
@@ -278,7 +278,10 @@ export class AppSyncApi extends Construct {
|
|
|
278
278
|
{});
|
|
279
279
|
// build schema
|
|
280
280
|
let mainSchema;
|
|
281
|
-
if (
|
|
281
|
+
if (!schema) {
|
|
282
|
+
throw new Error(`Missing "schema" in "${id}" AppSyncApi`);
|
|
283
|
+
}
|
|
284
|
+
else if (typeof schema === "string") {
|
|
282
285
|
mainSchema = appsync.SchemaFile.fromAsset(schema);
|
|
283
286
|
}
|
|
284
287
|
else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Function as CdkFunction } from "aws-cdk-lib/aws-lambda";
|
|
2
2
|
import { SsrSite } from "./SsrSite.js";
|
|
3
3
|
import { EdgeFunction } from "./EdgeFunction.js";
|
|
4
4
|
/**
|
|
@@ -19,6 +19,6 @@ export declare class AstroSite extends SsrSite {
|
|
|
19
19
|
clientBuildVersionedSubDir: string;
|
|
20
20
|
};
|
|
21
21
|
protected validateBuildOutput(): void;
|
|
22
|
-
protected createFunctionForRegional():
|
|
22
|
+
protected createFunctionForRegional(): CdkFunction;
|
|
23
23
|
protected createFunctionForEdge(): EdgeFunction;
|
|
24
24
|
}
|
package/constructs/AstroSite.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import url from "url";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import
|
|
4
|
+
import { buildSync } from "esbuild";
|
|
5
|
+
import { Architecture } from "aws-cdk-lib/aws-lambda";
|
|
5
6
|
import { SsrSite } from "./SsrSite.js";
|
|
6
7
|
import { Function } from "./Function.js";
|
|
7
8
|
import { useProject } from "../project.js";
|
|
@@ -50,6 +51,7 @@ export class AstroSite extends SsrSite {
|
|
|
50
51
|
},
|
|
51
52
|
environment,
|
|
52
53
|
...cdk?.server,
|
|
54
|
+
architecture: cdk?.server?.architecture === Architecture.ARM_64 ? "arm_64" : "x86_64",
|
|
53
55
|
});
|
|
54
56
|
fn._disableBind = true;
|
|
55
57
|
return fn;
|
|
@@ -59,7 +61,7 @@ export class AstroSite extends SsrSite {
|
|
|
59
61
|
// Create a directory that we will use to create the bundled version
|
|
60
62
|
// of the "core server build" along with our custom Lamba server handler.
|
|
61
63
|
const outputPath = path.resolve(path.join(useProject().paths.artifacts, `AstroSiteFunction-${this.node.id}-${this.node.addr}`));
|
|
62
|
-
const result =
|
|
64
|
+
const result = buildSync({
|
|
63
65
|
entryPoints: [
|
|
64
66
|
path.join(this.props.path, this.buildConfig.serverBuildOutputFile),
|
|
65
67
|
],
|
package/constructs/NextjsSite.js
CHANGED
|
@@ -37,7 +37,7 @@ export class NextjsSite extends SsrSite {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
createFunctionForRegional() {
|
|
40
|
-
const { timeout, memorySize, permissions, environment } = this.props;
|
|
40
|
+
const { timeout, memorySize, permissions, environment, cdk } = this.props;
|
|
41
41
|
const ssrFn = new SsrFunction(this, `ServerFunction`, {
|
|
42
42
|
description: "Server handler for Next.js",
|
|
43
43
|
bundlePath: path.join(this.props.path, ".open-next", "server-function"),
|
|
@@ -46,11 +46,12 @@ export class NextjsSite extends SsrSite {
|
|
|
46
46
|
memorySize,
|
|
47
47
|
permissions,
|
|
48
48
|
environment,
|
|
49
|
+
...cdk?.server,
|
|
49
50
|
});
|
|
50
51
|
return ssrFn.function;
|
|
51
52
|
}
|
|
52
53
|
createImageOptimizationFunctionForRegional() {
|
|
53
|
-
const { imageOptimization, path: sitePath
|
|
54
|
+
const { imageOptimization, path: sitePath } = this.props;
|
|
54
55
|
return new lambda.Function(this, `ImageFunction`, {
|
|
55
56
|
description: "Image optimization handler for Next.js",
|
|
56
57
|
handler: "index.handler",
|
|
@@ -70,7 +71,6 @@ export class NextjsSite extends SsrSite {
|
|
|
70
71
|
environment: {
|
|
71
72
|
BUCKET_NAME: this.cdk.bucket.bucketName,
|
|
72
73
|
},
|
|
73
|
-
...cdk?.server,
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
createMiddlewareEdgeFunctionForRegional() {
|
|
@@ -89,8 +89,8 @@ export class NextjsSite extends SsrSite {
|
|
|
89
89
|
const fn = new EdgeFunction(this, "Middleware", {
|
|
90
90
|
bundlePath,
|
|
91
91
|
handler,
|
|
92
|
-
timeout:
|
|
93
|
-
memorySize:
|
|
92
|
+
timeout: 5,
|
|
93
|
+
memorySize: 128,
|
|
94
94
|
permissions,
|
|
95
95
|
environment,
|
|
96
96
|
format: "esm",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Function as CdkFunction } from "aws-cdk-lib/aws-lambda";
|
|
2
2
|
import { SsrSite } from "./SsrSite.js";
|
|
3
3
|
import { EdgeFunction } from "./EdgeFunction.js";
|
|
4
4
|
/**
|
|
@@ -18,6 +18,6 @@ export declare class SolidStartSite extends SsrSite {
|
|
|
18
18
|
clientBuildOutputDir: string;
|
|
19
19
|
clientBuildVersionedSubDir: string;
|
|
20
20
|
};
|
|
21
|
-
protected createFunctionForRegional():
|
|
21
|
+
protected createFunctionForRegional(): CdkFunction;
|
|
22
22
|
protected createFunctionForEdge(): EdgeFunction;
|
|
23
23
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
|
-
import url from "url";
|
|
3
2
|
import path from "path";
|
|
4
|
-
import
|
|
3
|
+
import { buildSync } from "esbuild";
|
|
4
|
+
import { Architecture } from "aws-cdk-lib/aws-lambda";
|
|
5
5
|
import { SsrSite } from "./SsrSite.js";
|
|
6
6
|
import { Function } from "./Function.js";
|
|
7
7
|
import { useProject } from "../project.js";
|
|
8
8
|
import { EdgeFunction } from "./EdgeFunction.js";
|
|
9
|
-
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
10
9
|
/**
|
|
11
10
|
* The `SolidStartSite` construct is a higher level CDK construct that makes it easy to create a SolidStart app.
|
|
12
11
|
* @example
|
|
@@ -43,6 +42,7 @@ export class SolidStartSite extends SsrSite {
|
|
|
43
42
|
},
|
|
44
43
|
environment,
|
|
45
44
|
...cdk?.server,
|
|
45
|
+
architecture: cdk?.server?.architecture === Architecture.ARM_64 ? "arm_64" : "x86_64",
|
|
46
46
|
});
|
|
47
47
|
fn._disableBind = true;
|
|
48
48
|
return fn;
|
|
@@ -53,7 +53,7 @@ export class SolidStartSite extends SsrSite {
|
|
|
53
53
|
// of the "core server build" along with our custom Lamba server handler.
|
|
54
54
|
const outputPath = path.resolve(path.join(useProject().paths.artifacts, `SolidStartSiteFunction-${this.node.id}-${this.node.addr}`));
|
|
55
55
|
// Bundle code
|
|
56
|
-
const result =
|
|
56
|
+
const result = buildSync({
|
|
57
57
|
entryPoints: [
|
|
58
58
|
path.join(this.props.path, this.buildConfig.serverBuildOutputFile),
|
|
59
59
|
],
|
|
@@ -3,14 +3,13 @@ import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
|
3
3
|
import { Permissions } from "./util/permission.js";
|
|
4
4
|
import { Size } from "./util/size.js";
|
|
5
5
|
import { Duration } from "./util/duration.js";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { FunctionOptions } from "aws-cdk-lib/aws-lambda";
|
|
7
|
+
export interface SsrFunctionProps extends Omit<FunctionOptions, "memorySize" | "timeout" | "runtime"> {
|
|
8
8
|
bundlePath: string;
|
|
9
9
|
handler: string;
|
|
10
10
|
timeout: number | Duration;
|
|
11
11
|
memorySize: number | Size;
|
|
12
12
|
permissions?: Permissions;
|
|
13
|
-
environment?: Record<string, string>;
|
|
14
13
|
}
|
|
15
14
|
export declare class SsrFunction extends Construct {
|
|
16
15
|
function: lambda.Function;
|
|
@@ -30,7 +30,7 @@ export class SsrFunction extends Construct {
|
|
|
30
30
|
attachPermissionsToRole(this.function.role, permissions);
|
|
31
31
|
}
|
|
32
32
|
createFunction() {
|
|
33
|
-
const { timeout, memorySize, handler, bundlePath
|
|
33
|
+
const { timeout, memorySize, handler, bundlePath } = this.props;
|
|
34
34
|
// Note: cannot point the bundlePath to the `.open-next/server-function`
|
|
35
35
|
// b/c the folder contains node_modules. And pnpm node_modules
|
|
36
36
|
// contains symlinks. CDK cannot zip symlinks correctly.
|
|
@@ -53,7 +53,7 @@ export class SsrFunction extends Construct {
|
|
|
53
53
|
// Deploy after the code is updated
|
|
54
54
|
const replacer = this.createLambdaCodeReplacer(asset);
|
|
55
55
|
const fn = new lambda.Function(this, `ServerFunction`, {
|
|
56
|
-
|
|
56
|
+
...this.props,
|
|
57
57
|
handler,
|
|
58
58
|
logRetention: logs.RetentionDays.THREE_DAYS,
|
|
59
59
|
code: lambda.Code.fromBucket(asset.bucket, asset.s3ObjectKey),
|
|
@@ -65,7 +65,6 @@ export class SsrFunction extends Construct {
|
|
|
65
65
|
timeout: typeof timeout === "string"
|
|
66
66
|
? toCdkDuration(timeout)
|
|
67
67
|
: CdkDuration.seconds(timeout),
|
|
68
|
-
environment,
|
|
69
68
|
});
|
|
70
69
|
fn.node.addDependency(replacer);
|
|
71
70
|
return fn;
|
package/constructs/SsrSite.d.ts
CHANGED
|
@@ -159,7 +159,7 @@ export interface SsrSiteProps {
|
|
|
159
159
|
*/
|
|
160
160
|
serverRequests?: ICachePolicy;
|
|
161
161
|
};
|
|
162
|
-
server?: Pick<FunctionProps, "vpc" | "vpcSubnets" | "securityGroups" | "allowAllOutbound" | "allowPublicSubnet">;
|
|
162
|
+
server?: Pick<FunctionProps, "vpc" | "vpcSubnets" | "securityGroups" | "allowAllOutbound" | "allowPublicSubnet" | "architecture">;
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
165
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sst",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.64",
|
|
4
4
|
"bin": {
|
|
5
5
|
"sst": "cli/sst.js"
|
|
6
6
|
},
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@aws-sdk/client-codebuild": "^3.257.0",
|
|
94
94
|
"@aws-sdk/types": "^3.208.0",
|
|
95
|
+
"@graphql-tools/merge": "^8.3.16",
|
|
95
96
|
"@sls-next/lambda-at-edge": "^3.7.0",
|
|
96
97
|
"@tsconfig/node16": "^1.0.3",
|
|
97
98
|
"@types/adm-zip": "^0.5.0",
|