sst 2.33.1 → 2.33.3
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 -0
- package/cli/sst.js +0 -2
- package/cli/ui/header.js +1 -1
- package/constructs/EdgeFunction.js +1 -1
- package/constructs/Service.d.ts +15 -13
- package/constructs/Service.js +9 -7
- package/package.json +2 -2
- package/project.d.ts +1 -0
- package/cli/commands/connect.d.ts +0 -17
- package/cli/commands/connect.js +0 -55
package/bootstrap.js
CHANGED
|
@@ -182,6 +182,7 @@ export async function bootstrapSST(cdkBucket) {
|
|
|
182
182
|
bucketArn: `arn:${stack.partition}:s3:::${cdkBucket}`,
|
|
183
183
|
}
|
|
184
184
|
: new Bucket(stack, region, {
|
|
185
|
+
bucketName: bootstrap?.bucketName,
|
|
185
186
|
encryption: BucketEncryption.S3_MANAGED,
|
|
186
187
|
removalPolicy: RemovalPolicy.DESTROY,
|
|
187
188
|
autoDeleteObjects: true,
|
package/cli/sst.js
CHANGED
|
@@ -25,7 +25,6 @@ import { diff } from "./commands/diff.js";
|
|
|
25
25
|
import { version } from "./commands/version.js";
|
|
26
26
|
import { telemetry } from "./commands/telemetry.js";
|
|
27
27
|
import { types } from "./commands/types.js";
|
|
28
|
-
import { connect } from "./commands/connect.js";
|
|
29
28
|
bootstrap(program);
|
|
30
29
|
dev(program);
|
|
31
30
|
deploy(program);
|
|
@@ -40,7 +39,6 @@ diff(program);
|
|
|
40
39
|
version(program);
|
|
41
40
|
telemetry(program);
|
|
42
41
|
types(program);
|
|
43
|
-
connect(program);
|
|
44
42
|
if ("setSourceMapsEnabled" in process) {
|
|
45
43
|
// @ts-expect-error
|
|
46
44
|
process.setSourceMapsEnabled(true);
|
package/cli/ui/header.js
CHANGED
|
@@ -9,7 +9,7 @@ export async function printHeader(input) {
|
|
|
9
9
|
Colors.line(`${Colors.primary(` `)} ${Colors.bold("Stage:")} ${project.config.stage}`);
|
|
10
10
|
if (input.console) {
|
|
11
11
|
const local = await useLocalServerConfig();
|
|
12
|
-
Colors.line(`${Colors.primary(` `)} ${Colors.bold("Console:")} ${Colors.link(local.url)}`);
|
|
12
|
+
Colors.line(`${Colors.primary(` `)} ${Colors.bold("Console:")} ${Colors.link(local.url + `/local/${project.config.name}/${project.config.stage}`)}`);
|
|
13
13
|
}
|
|
14
14
|
Colors.gap();
|
|
15
15
|
}
|
|
@@ -326,7 +326,7 @@ export class EdgeFunction extends Construct {
|
|
|
326
326
|
FunctionBucket: lambdaBucket.getAttString("BucketName"),
|
|
327
327
|
FunctionParams: {
|
|
328
328
|
Description: `${this.node.id} handler`,
|
|
329
|
-
Handler: handler,
|
|
329
|
+
Handler: path.posix.join(...handler.split(path.sep)),
|
|
330
330
|
Code: {
|
|
331
331
|
S3Bucket: assetBucket,
|
|
332
332
|
S3Key: assetKey,
|
package/constructs/Service.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { FunctionBindingProps } from "./util/functionBinding.js";
|
|
|
7
7
|
import { IVpc } from "aws-cdk-lib/aws-ec2";
|
|
8
8
|
import { Cluster, ContainerDefinitionOptions, CpuArchitecture, FargateService, FargateTaskDefinition, FargateServiceProps } from "aws-cdk-lib/aws-ecs";
|
|
9
9
|
import { RetentionDays } from "aws-cdk-lib/aws-logs";
|
|
10
|
-
import { ApplicationTargetGroupProps } from "aws-cdk-lib/aws-elasticloadbalancingv2";
|
|
10
|
+
import { ApplicationLoadBalancer, ApplicationLoadBalancerProps, ApplicationTargetGroupProps } from "aws-cdk-lib/aws-elasticloadbalancingv2";
|
|
11
11
|
declare const supportedCpus: {
|
|
12
12
|
"0.25 vCPU": number;
|
|
13
13
|
"0.5 vCPU": number;
|
|
@@ -299,7 +299,7 @@ export interface ServiceProps {
|
|
|
299
299
|
* }
|
|
300
300
|
* ```
|
|
301
301
|
*/
|
|
302
|
-
applicationLoadBalancer?: boolean
|
|
302
|
+
applicationLoadBalancer?: boolean | Omit<ApplicationLoadBalancerProps, "vpc">;
|
|
303
303
|
/**
|
|
304
304
|
* Customize the Application Load Balancer's target group.
|
|
305
305
|
* @default true
|
|
@@ -392,12 +392,13 @@ export declare class Service extends Construct implements SSTConstruct {
|
|
|
392
392
|
private props;
|
|
393
393
|
private doNotDeploy;
|
|
394
394
|
private devFunction?;
|
|
395
|
-
private vpc
|
|
396
|
-
private cluster
|
|
397
|
-
private container
|
|
398
|
-
private taskDefinition
|
|
399
|
-
private service
|
|
395
|
+
private vpc?;
|
|
396
|
+
private cluster?;
|
|
397
|
+
private container?;
|
|
398
|
+
private taskDefinition?;
|
|
399
|
+
private service?;
|
|
400
400
|
private distribution?;
|
|
401
|
+
private alb?;
|
|
401
402
|
constructor(scope: Construct, id: string, props?: ServiceProps);
|
|
402
403
|
/**
|
|
403
404
|
* The CloudFront URL of the website.
|
|
@@ -412,11 +413,12 @@ export declare class Service extends Construct implements SSTConstruct {
|
|
|
412
413
|
* The internally created CDK resources.
|
|
413
414
|
*/
|
|
414
415
|
get cdk(): {
|
|
415
|
-
vpc: IVpc;
|
|
416
|
-
cluster: Cluster;
|
|
417
|
-
fargateService: FargateService;
|
|
418
|
-
taskDefinition: FargateTaskDefinition;
|
|
416
|
+
vpc: IVpc | undefined;
|
|
417
|
+
cluster: Cluster | undefined;
|
|
418
|
+
fargateService: FargateService | undefined;
|
|
419
|
+
taskDefinition: FargateTaskDefinition | undefined;
|
|
419
420
|
distribution: import("aws-cdk-lib/aws-cloudfront").IDistribution | undefined;
|
|
421
|
+
applicationLoadBalancer: ApplicationLoadBalancer | undefined;
|
|
420
422
|
hostedZone: import("aws-cdk-lib/aws-route53").IHostedZone | undefined;
|
|
421
423
|
certificate: import("aws-cdk-lib/aws-certificatemanager").ICertificate | undefined;
|
|
422
424
|
} | undefined;
|
|
@@ -428,8 +430,8 @@ export declare class Service extends Construct implements SSTConstruct {
|
|
|
428
430
|
customDomainUrl: string | undefined;
|
|
429
431
|
url: string | undefined;
|
|
430
432
|
devFunction: string | undefined;
|
|
431
|
-
task: string;
|
|
432
|
-
container: string;
|
|
433
|
+
task: string | undefined;
|
|
434
|
+
container: string | undefined;
|
|
433
435
|
secrets: string[];
|
|
434
436
|
};
|
|
435
437
|
};
|
package/constructs/Service.js
CHANGED
|
@@ -147,6 +147,7 @@ export class Service extends Construct {
|
|
|
147
147
|
taskDefinition;
|
|
148
148
|
service;
|
|
149
149
|
distribution;
|
|
150
|
+
alb;
|
|
150
151
|
constructor(scope, id, props) {
|
|
151
152
|
super(scope, id);
|
|
152
153
|
const app = scope.node.root;
|
|
@@ -167,12 +168,6 @@ export class Service extends Construct {
|
|
|
167
168
|
this.validateMemoryAndCpu();
|
|
168
169
|
useServices().add(stack.stackName, id, this.props);
|
|
169
170
|
if (this.doNotDeploy) {
|
|
170
|
-
// @ts-expect-error
|
|
171
|
-
this.vpc = this.cluster = null;
|
|
172
|
-
// @ts-expect-error
|
|
173
|
-
this.service = this.container = this.taskDefinition = null;
|
|
174
|
-
// @ts-expect-error
|
|
175
|
-
this.distribution = null;
|
|
176
171
|
this.devFunction = this.createDevFunction();
|
|
177
172
|
app.registerTypes(this);
|
|
178
173
|
return;
|
|
@@ -182,6 +177,7 @@ export class Service extends Construct {
|
|
|
182
177
|
const { cluster, container, taskDefinition, service } = this.createService(vpc);
|
|
183
178
|
const { alb, target } = this.createLoadBalancer(vpc, service);
|
|
184
179
|
this.createAutoScaling(service, target);
|
|
180
|
+
this.alb = alb;
|
|
185
181
|
// Create Distribution
|
|
186
182
|
this.distribution = this.createDistribution(alb);
|
|
187
183
|
this.vpc = vpc;
|
|
@@ -250,6 +246,7 @@ export class Service extends Construct {
|
|
|
250
246
|
fargateService: this.service,
|
|
251
247
|
taskDefinition: this.taskDefinition,
|
|
252
248
|
distribution: this.distribution?.cdk.distribution,
|
|
249
|
+
applicationLoadBalancer: this.alb,
|
|
253
250
|
hostedZone: this.distribution?.cdk.hostedZone,
|
|
254
251
|
certificate: this.distribution?.cdk.certificate,
|
|
255
252
|
};
|
|
@@ -453,6 +450,9 @@ export class Service extends Construct {
|
|
|
453
450
|
const alb = new ApplicationLoadBalancer(this, "LoadBalancer", {
|
|
454
451
|
vpc,
|
|
455
452
|
internetFacing: true,
|
|
453
|
+
...(cdk?.applicationLoadBalancer === true
|
|
454
|
+
? {}
|
|
455
|
+
: cdk?.applicationLoadBalancer),
|
|
456
456
|
});
|
|
457
457
|
const listener = alb.addListener("Listener", { port: 80 });
|
|
458
458
|
const target = listener.addTargets("TargetGroup", {
|
|
@@ -563,9 +563,11 @@ export class Service extends Construct {
|
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
565
|
addEnvironmentForService(name, value) {
|
|
566
|
-
this.container
|
|
566
|
+
this.container?.addEnvironment(name, value);
|
|
567
567
|
}
|
|
568
568
|
attachPermissionsForService(permissions) {
|
|
569
|
+
if (!this.taskDefinition)
|
|
570
|
+
return;
|
|
569
571
|
attachPermissionsToRole(this.taskDefinition.taskRole, permissions);
|
|
570
572
|
}
|
|
571
573
|
/////////////////////
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "sst",
|
|
4
|
-
"version": "2.33.
|
|
4
|
+
"version": "2.33.3",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sst": "cli/sst.js"
|
|
7
7
|
},
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"tsx": "^3.12.1",
|
|
125
125
|
"typescript": "^5.2.2",
|
|
126
126
|
"vitest": "^0.33.0",
|
|
127
|
-
"astro-sst": "2.33.
|
|
127
|
+
"astro-sst": "2.33.3"
|
|
128
128
|
},
|
|
129
129
|
"peerDependencies": {
|
|
130
130
|
"@sls-next/lambda-at-edge": "^3.7.0"
|
package/project.d.ts
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
import type { Program } from "../program.js";
|
|
3
|
-
export declare const connect: (program: Program) => import("yargs").Argv<{
|
|
4
|
-
stage: string | undefined;
|
|
5
|
-
} & {
|
|
6
|
-
profile: string | undefined;
|
|
7
|
-
} & {
|
|
8
|
-
region: string | undefined;
|
|
9
|
-
} & {
|
|
10
|
-
verbose: boolean | undefined;
|
|
11
|
-
} & {
|
|
12
|
-
role: string | undefined;
|
|
13
|
-
} & {
|
|
14
|
-
future: boolean | undefined;
|
|
15
|
-
} & {
|
|
16
|
-
dev: boolean;
|
|
17
|
-
}>;
|
package/cli/commands/connect.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Colors } from "../colors.js";
|
|
2
|
-
export const connect = (program) => program.command("connect", "Connect a stage to SST Console", (yargs) => yargs.option("dev", {
|
|
3
|
-
type: "boolean",
|
|
4
|
-
default: false,
|
|
5
|
-
describe: "Connect to SST dev account (probably don't want to do this)",
|
|
6
|
-
}), async (args) => {
|
|
7
|
-
if (!args.future)
|
|
8
|
-
throw new Error("This command is not yet available.");
|
|
9
|
-
const { exit, exitWithError } = await import("../program.js");
|
|
10
|
-
const { useAWSClient } = await import("../../credentials.js");
|
|
11
|
-
const { useProject } = await import("../../project.js");
|
|
12
|
-
const { useSTSIdentity } = await import("../../credentials.js");
|
|
13
|
-
const { IAMClient, CreateRoleCommand, AttachRolePolicyCommand } = await import("@aws-sdk/client-iam");
|
|
14
|
-
try {
|
|
15
|
-
const client = useAWSClient(IAMClient);
|
|
16
|
-
if (args.dev) {
|
|
17
|
-
Colors.line(Colors.warning("⚠"), Colors.bold(" Connecting to dev stage"));
|
|
18
|
-
}
|
|
19
|
-
await client
|
|
20
|
-
.send(new CreateRoleCommand({
|
|
21
|
-
RoleName: "sst",
|
|
22
|
-
AssumeRolePolicyDocument: JSON.stringify({
|
|
23
|
-
Version: "2012-10-17",
|
|
24
|
-
Statement: [
|
|
25
|
-
{
|
|
26
|
-
Effect: "Allow",
|
|
27
|
-
Principal: {
|
|
28
|
-
AWS: `arn:aws:iam::${args.dev ? "917397401067" : "226609089145"}:root`,
|
|
29
|
-
},
|
|
30
|
-
Action: "sts:AssumeRole",
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
}),
|
|
34
|
-
}))
|
|
35
|
-
.catch((e) => {
|
|
36
|
-
if (e.Error.Code === "EntityAlreadyExists")
|
|
37
|
-
return;
|
|
38
|
-
throw e;
|
|
39
|
-
});
|
|
40
|
-
await client.send(new AttachRolePolicyCommand({
|
|
41
|
-
RoleName: "sst",
|
|
42
|
-
PolicyArn: "arn:aws:iam::aws:policy/AdministratorAccess",
|
|
43
|
-
}));
|
|
44
|
-
const project = useProject();
|
|
45
|
-
const identity = await useSTSIdentity();
|
|
46
|
-
const host = args.dev
|
|
47
|
-
? "http://localhost:3000"
|
|
48
|
-
: "https://console.production.sst.dev";
|
|
49
|
-
console.log(`${host}/connect?app=${project.config.name}&stage=${project.config.stage}&aws_account_id=${identity.Account}®ion=${project.config.region}`);
|
|
50
|
-
await exit();
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
await exitWithError(e);
|
|
54
|
-
}
|
|
55
|
-
});
|