sst 2.37.0 → 2.37.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/constructs/AstroSite.js +10 -0
- package/constructs/Distribution.js +10 -6
- package/constructs/EdgeFunction.js +1 -0
- package/constructs/Function.d.ts +2 -0
- package/constructs/Function.js +3 -1
- package/constructs/RDS.js +2 -0
- package/constructs/Service.d.ts +13 -1
- package/constructs/Service.js +16 -6
- package/constructs/SsrFunction.js +5 -2
- package/node/future/auth/index.d.ts +1 -0
- package/node/future/auth/index.js +1 -0
- package/node/graphql/index.d.ts +1 -1
- package/package.json +2 -2
package/constructs/AstroSite.js
CHANGED
|
@@ -131,6 +131,10 @@ export class AstroSite extends SsrSite {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
else {
|
|
134
|
+
plan.cloudFrontFunctions.imageServiceCfFunction = {
|
|
135
|
+
constructId: "ImageServiceCloudFrontFunction",
|
|
136
|
+
injections: [this.useCloudFrontFunctionHostHeaderInjection()],
|
|
137
|
+
};
|
|
134
138
|
plan.origins.regionalServer = {
|
|
135
139
|
type: "function",
|
|
136
140
|
constructId: "ServerFunction",
|
|
@@ -152,6 +156,12 @@ export class AstroSite extends SsrSite {
|
|
|
152
156
|
cacheType: "static",
|
|
153
157
|
pattern: `${buildMeta.clientBuildVersionedSubDir}/*`,
|
|
154
158
|
origin: "staticsServer",
|
|
159
|
+
}, {
|
|
160
|
+
cacheType: "server",
|
|
161
|
+
pattern: "_image",
|
|
162
|
+
cfFunction: "imageServiceCfFunction",
|
|
163
|
+
origin: "regionalServer",
|
|
164
|
+
allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
|
|
155
165
|
}, ...buildMeta.serverRoutes?.map((route) => ({
|
|
156
166
|
cacheType: "server",
|
|
157
167
|
pattern: route,
|
|
@@ -8,6 +8,7 @@ import { Stack } from "./Stack.js";
|
|
|
8
8
|
import { isCDKConstruct } from "./Construct.js";
|
|
9
9
|
import { HttpsRedirect } from "./cdk/website-redirect.js";
|
|
10
10
|
import { DnsValidatedCertificate } from "./cdk/dns-validated-certificate.js";
|
|
11
|
+
import { VisibleError } from "../error.js";
|
|
11
12
|
export class Distribution extends Construct {
|
|
12
13
|
scope;
|
|
13
14
|
props;
|
|
@@ -108,10 +109,10 @@ export class Distribution extends Construct {
|
|
|
108
109
|
if (!cdk?.distribution)
|
|
109
110
|
return;
|
|
110
111
|
if (cdk.distribution.certificate) {
|
|
111
|
-
throw new
|
|
112
|
+
throw new VisibleError(`Do not configure the "cfDistribution.certificate". Use the "customDomain" to configure the domain certificate.`);
|
|
112
113
|
}
|
|
113
114
|
if (cdk.distribution.domainNames) {
|
|
114
|
-
throw new
|
|
115
|
+
throw new VisibleError(`Do not configure the "cfDistribution.domainNames". Use the "customDomain" to configure the domain name.`);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
validateCustomDomainSettings() {
|
|
@@ -122,15 +123,18 @@ export class Distribution extends Construct {
|
|
|
122
123
|
if (typeof customDomain === "string") {
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
126
|
+
if (!customDomain.domainName) {
|
|
127
|
+
throw new VisibleError(`Missing "domainName" for customDomain.`);
|
|
128
|
+
}
|
|
125
129
|
if (customDomain.isExternalDomain === true) {
|
|
126
130
|
if (!customDomain.cdk?.certificate) {
|
|
127
|
-
throw new
|
|
131
|
+
throw new VisibleError(`A valid certificate is required when "isExternalDomain" is set to "true".`);
|
|
128
132
|
}
|
|
129
133
|
if (customDomain.domainAlias) {
|
|
130
|
-
throw new
|
|
134
|
+
throw new VisibleError(`Domain alias is only supported for domains hosted on Amazon Route 53. Do not set the "customDomain.domainAlias" when "isExternalDomain" is enabled.`);
|
|
131
135
|
}
|
|
132
136
|
if (customDomain.hostedZone) {
|
|
133
|
-
throw new
|
|
137
|
+
throw new VisibleError(`Hosted zones can only be configured for domains hosted on Amazon Route 53. Do not set the "customDomain.hostedZone" when "isExternalDomain" is enabled.`);
|
|
134
138
|
}
|
|
135
139
|
}
|
|
136
140
|
}
|
|
@@ -223,7 +227,7 @@ export class Distribution extends Construct {
|
|
|
223
227
|
domainNames.push(customDomain.domainName);
|
|
224
228
|
if (customDomain.alternateNames) {
|
|
225
229
|
if (!customDomain.cdk?.certificate)
|
|
226
|
-
throw new
|
|
230
|
+
throw new VisibleError("Certificates for alternate domains cannot be automatically created. Please specify certificate to use");
|
|
227
231
|
domainNames.push(...customDomain.alternateNames);
|
|
228
232
|
}
|
|
229
233
|
}
|
package/constructs/Function.d.ts
CHANGED
|
@@ -686,6 +686,8 @@ export declare class Function extends CDKFunction implements SSTConstruct {
|
|
|
686
686
|
readonly _isLiveDevEnabled: boolean;
|
|
687
687
|
/** @internal */
|
|
688
688
|
readonly _doNotAllowOthersToBind?: boolean;
|
|
689
|
+
/** @internal */
|
|
690
|
+
_overrideMetadataHandler?: string;
|
|
689
691
|
private missingSourcemap?;
|
|
690
692
|
private functionUrl?;
|
|
691
693
|
private props;
|
package/constructs/Function.js
CHANGED
|
@@ -67,6 +67,8 @@ export class Function extends CDKFunction {
|
|
|
67
67
|
_isLiveDevEnabled;
|
|
68
68
|
/** @internal */
|
|
69
69
|
_doNotAllowOthersToBind;
|
|
70
|
+
/** @internal */
|
|
71
|
+
_overrideMetadataHandler;
|
|
70
72
|
missingSourcemap;
|
|
71
73
|
functionUrl;
|
|
72
74
|
props;
|
|
@@ -371,7 +373,7 @@ export class Function extends CDKFunction {
|
|
|
371
373
|
data: {
|
|
372
374
|
arn: this.functionArn,
|
|
373
375
|
runtime: this.props.runtime,
|
|
374
|
-
handler: this.props.handler,
|
|
376
|
+
handler: this._overrideMetadataHandler ?? this.props.handler,
|
|
375
377
|
missingSourcemap: this.missingSourcemap === true ? true : undefined,
|
|
376
378
|
localId: this.node.addr,
|
|
377
379
|
secrets: this.allBindings
|
package/constructs/RDS.js
CHANGED
|
@@ -312,6 +312,8 @@ export class RDS extends Construct {
|
|
|
312
312
|
},
|
|
313
313
|
_doNotAllowOthersToBind: true,
|
|
314
314
|
});
|
|
315
|
+
this.migratorFunction._overrideMetadataHandler =
|
|
316
|
+
"rds-migrator/index.handler";
|
|
315
317
|
}
|
|
316
318
|
createMigrationCustomResource(migrations) {
|
|
317
319
|
const app = this.node.root;
|
package/constructs/Service.d.ts
CHANGED
|
@@ -65,6 +65,17 @@ export interface ServiceProps {
|
|
|
65
65
|
*```
|
|
66
66
|
*/
|
|
67
67
|
memory?: `${number} GB`;
|
|
68
|
+
/**
|
|
69
|
+
* The amount of ephemeral storage allocated, in GB.
|
|
70
|
+
* @default "20 GB"
|
|
71
|
+
* @example
|
|
72
|
+
* ```js
|
|
73
|
+
* {
|
|
74
|
+
* storage: "100 GB",
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
storage?: `${number} GB`;
|
|
68
79
|
/**
|
|
69
80
|
* The port number on the container.
|
|
70
81
|
* @default 3000
|
|
@@ -373,6 +384,7 @@ type ServiceNormalizedProps = ServiceProps & {
|
|
|
373
384
|
cpu: Exclude<ServiceProps["cpu"], undefined>;
|
|
374
385
|
path: Exclude<ServiceProps["path"], undefined>;
|
|
375
386
|
memory: Exclude<ServiceProps["memory"], undefined>;
|
|
387
|
+
storage: Exclude<ServiceProps["storage"], undefined>;
|
|
376
388
|
port: Exclude<ServiceProps["port"], undefined>;
|
|
377
389
|
logRetention: Exclude<ServiceProps["logRetention"], undefined>;
|
|
378
390
|
};
|
|
@@ -468,7 +480,7 @@ export declare class Service extends Construct implements SSTConstruct {
|
|
|
468
480
|
*/
|
|
469
481
|
addEnvironment(name: string, value: string): void;
|
|
470
482
|
private validateServiceExists;
|
|
471
|
-
private
|
|
483
|
+
private validateMemoryCpuAndStorage;
|
|
472
484
|
private createVpc;
|
|
473
485
|
private createService;
|
|
474
486
|
private createLoadBalancer;
|
package/constructs/Service.js
CHANGED
|
@@ -18,12 +18,13 @@ import { useDeferredTasks } from "./deferred_task.js";
|
|
|
18
18
|
import { attachPermissionsToRole } from "./util/permission.js";
|
|
19
19
|
import { bindEnvironment, bindPermissions, getParameterPath, getReferencedSecrets, } from "./util/functionBinding.js";
|
|
20
20
|
import { useProject } from "../project.js";
|
|
21
|
-
import { Vpc
|
|
21
|
+
import { Vpc } from "aws-cdk-lib/aws-ec2";
|
|
22
22
|
import { AwsLogDriver, Cluster, ContainerImage, CpuArchitecture, FargateService, FargateTaskDefinition, } from "aws-cdk-lib/aws-ecs";
|
|
23
23
|
import { LogGroup, LogRetention, RetentionDays } from "aws-cdk-lib/aws-logs";
|
|
24
24
|
import { Platform } from "aws-cdk-lib/aws-ecr-assets";
|
|
25
25
|
import { ApplicationLoadBalancer, } from "aws-cdk-lib/aws-elasticloadbalancingv2";
|
|
26
26
|
import { createAppContext } from "./context.js";
|
|
27
|
+
import { toCdkSize } from "./index.js";
|
|
27
28
|
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
28
29
|
const NIXPACKS_IMAGE_NAME = "sst-nixpacks";
|
|
29
30
|
const supportedCpus = {
|
|
@@ -158,6 +159,7 @@ export class Service extends Construct {
|
|
|
158
159
|
architecture: props?.architecture || "x86_64",
|
|
159
160
|
cpu: props?.cpu || "0.25 vCPU",
|
|
160
161
|
memory: props?.memory || "0.5 GB",
|
|
162
|
+
storage: props?.storage || "20 GB",
|
|
161
163
|
port: props?.port || 3000,
|
|
162
164
|
logRetention: props?.logRetention || "infinite",
|
|
163
165
|
...props,
|
|
@@ -165,7 +167,7 @@ export class Service extends Construct {
|
|
|
165
167
|
this.doNotDeploy =
|
|
166
168
|
!stack.isActive || (app.mode === "dev" && !this.props.dev?.deploy);
|
|
167
169
|
this.validateServiceExists();
|
|
168
|
-
this.
|
|
170
|
+
this.validateMemoryCpuAndStorage();
|
|
169
171
|
useServices().add(stack.stackName, id, this.props);
|
|
170
172
|
if (this.doNotDeploy) {
|
|
171
173
|
this.devFunction = this.createDevFunction();
|
|
@@ -376,8 +378,8 @@ export class Service extends Construct {
|
|
|
376
378
|
}
|
|
377
379
|
}
|
|
378
380
|
}
|
|
379
|
-
|
|
380
|
-
const { memory, cpu } = this.props;
|
|
381
|
+
validateMemoryCpuAndStorage() {
|
|
382
|
+
const { memory, cpu, storage } = this.props;
|
|
381
383
|
if (!supportedCpus[cpu]) {
|
|
382
384
|
throw new VisibleError(`In the "${this.node.id}" Service, only the following "cpu" settings are supported: ${Object.keys(supportedCpus).join(", ")}`);
|
|
383
385
|
}
|
|
@@ -385,6 +387,10 @@ export class Service extends Construct {
|
|
|
385
387
|
if (!supportedMemories[cpu][memory]) {
|
|
386
388
|
throw new VisibleError(`In the "${this.node.id}" Service, only the following "memory" settings are supported with "${cpu}": ${Object.keys(supportedMemories[cpu]).join(", ")}`);
|
|
387
389
|
}
|
|
390
|
+
const storageInGiB = toCdkSize(storage).toGibibytes();
|
|
391
|
+
if (storageInGiB < 20 || storageInGiB > 200) {
|
|
392
|
+
throw new VisibleError(`In the "${this.node.id}" Service, the supported value for storage is between "20 GB" and "200 GB"`);
|
|
393
|
+
}
|
|
388
394
|
}
|
|
389
395
|
createVpc() {
|
|
390
396
|
const { cdk } = this.props;
|
|
@@ -394,7 +400,7 @@ export class Service extends Construct {
|
|
|
394
400
|
}));
|
|
395
401
|
}
|
|
396
402
|
createService(vpc) {
|
|
397
|
-
const { architecture, cpu, memory, port, logRetention, cdk } = this.props;
|
|
403
|
+
const { architecture, cpu, memory, storage, port, logRetention, cdk } = this.props;
|
|
398
404
|
const app = this.node.root;
|
|
399
405
|
const clusterName = app.logicalPrefixedName(this.node.id);
|
|
400
406
|
const logGroup = new LogRetention(this, "LogRetention", {
|
|
@@ -408,10 +414,14 @@ export class Service extends Construct {
|
|
|
408
414
|
clusterName,
|
|
409
415
|
vpc,
|
|
410
416
|
});
|
|
417
|
+
const ephemeralStorageGiB = toCdkSize(storage).toGibibytes();
|
|
411
418
|
const taskDefinition = new FargateTaskDefinition(this, `TaskDefinition`, {
|
|
412
|
-
// @ts-
|
|
419
|
+
// @ts-expect-error
|
|
413
420
|
memoryLimitMiB: supportedMemories[cpu][memory],
|
|
414
421
|
cpu: supportedCpus[cpu],
|
|
422
|
+
// note: the minimum allowed value by CloudFormation is 21, set to
|
|
423
|
+
// undefined to set to the default value of 20
|
|
424
|
+
ephemeralStorageGiB: ephemeralStorageGiB === 20 ? undefined : ephemeralStorageGiB,
|
|
415
425
|
runtimePlatform: {
|
|
416
426
|
cpuArchitecture: architecture === "arm64"
|
|
417
427
|
? CpuArchitecture.ARM64
|
|
@@ -40,6 +40,7 @@ export class SsrFunction extends Construct {
|
|
|
40
40
|
memorySize: 1024,
|
|
41
41
|
streaming: false,
|
|
42
42
|
injections: [],
|
|
43
|
+
architecture: Architecture.ARM_64,
|
|
43
44
|
...props,
|
|
44
45
|
environment: props.environment || {},
|
|
45
46
|
permissions: props.permissions || [],
|
|
@@ -104,7 +105,7 @@ export class SsrFunction extends Construct {
|
|
|
104
105
|
: runtime === "nodejs16.x"
|
|
105
106
|
? Runtime.NODEJS_16_X
|
|
106
107
|
: Runtime.NODEJS_18_X,
|
|
107
|
-
architecture
|
|
108
|
+
architecture,
|
|
108
109
|
memorySize: typeof memorySize === "string"
|
|
109
110
|
? toCdkSize(memorySize).toMebibytes()
|
|
110
111
|
: memorySize,
|
|
@@ -173,11 +174,13 @@ export class SsrFunction extends Construct {
|
|
|
173
174
|
});
|
|
174
175
|
}
|
|
175
176
|
async buildAssetFromHandler() {
|
|
176
|
-
const { handler, runtime, nodejs, copyFiles,
|
|
177
|
+
const { handler, runtime, nodejs, copyFiles, architecture: enumArchitecture, } = this.props;
|
|
178
|
+
const architecture = enumArchitecture === Architecture.X86_64 ? "x86_64" : "arm_64";
|
|
177
179
|
useFunctions().add(this.node.addr, {
|
|
178
180
|
handler,
|
|
179
181
|
runtime,
|
|
180
182
|
nodejs,
|
|
183
|
+
architecture,
|
|
181
184
|
copyFiles,
|
|
182
185
|
});
|
|
183
186
|
// build function
|
|
@@ -10,6 +10,7 @@ export * from "./adapter/microsoft.js";
|
|
|
10
10
|
export * from "./adapter/oauth.js";
|
|
11
11
|
export * from "./adapter/spotify.js";
|
|
12
12
|
export * from "./adapter/code.js";
|
|
13
|
+
export * from "./adapter/apple.js";
|
|
13
14
|
export type { Adapter } from "./adapter/adapter.js";
|
|
14
15
|
export * from "./session.js";
|
|
15
16
|
export * from "./handler.js";
|
|
@@ -9,6 +9,7 @@ export * from "./adapter/microsoft.js";
|
|
|
9
9
|
export * from "./adapter/oauth.js";
|
|
10
10
|
export * from "./adapter/spotify.js";
|
|
11
11
|
export * from "./adapter/code.js";
|
|
12
|
+
export * from "./adapter/apple.js";
|
|
12
13
|
export * from "./session.js";
|
|
13
14
|
export * from "./handler.js";
|
|
14
15
|
export * from "./encryption.js";
|
package/node/graphql/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "sst",
|
|
4
|
-
"version": "2.37.
|
|
4
|
+
"version": "2.37.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.37.
|
|
123
|
+
"astro-sst": "2.37.1",
|
|
124
124
|
"async": "^3.2.4",
|
|
125
125
|
"tsx": "^3.12.1",
|
|
126
126
|
"typescript": "^5.2.2",
|