Skip to content

Commit 69145ab

Browse files
committed
vendor(sst): update aws-cdk-lib from 2.201 to 2.219
And fix test errors (again), it seems my previous fix wasn't enough.
1 parent 49df4ac commit 69145ab

File tree

7 files changed

+217
-140
lines changed

7 files changed

+217
-140
lines changed

packages/sst/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
},
3636
"homepage": "https://sst.dev",
3737
"dependencies": {
38-
"@aws-cdk/aws-lambda-python-alpha": "2.201.0-alpha.0",
39-
"@aws-cdk/cloud-assembly-schema": "44.5.0",
40-
"@aws-cdk/cloudformation-diff": "2.182.0",
41-
"@aws-cdk/cx-api": "2.201.0",
42-
"@aws-cdk/toolkit-lib": "1.1.1",
38+
"@aws-cdk/aws-lambda-python-alpha": "2.214.1-alpha.0",
39+
"@aws-cdk/cloud-assembly-schema": "48.14.0",
40+
"@aws-cdk/cloudformation-diff": "2.184.1",
41+
"@aws-cdk/cx-api": "2.214.1",
42+
"@aws-cdk/toolkit-lib": "1.10.0",
4343
"@aws-crypto/sha256-js": "^5.2.0",
4444
"@aws-sdk/client-cloudformation": "3.699.0",
4545
"@aws-sdk/client-ecs": "3.699.0",
@@ -64,7 +64,7 @@
6464
"@smithy/signature-v4": "2.0.16",
6565
"@trpc/server": "9.18.0",
6666
"adm-zip": "0.5.14",
67-
"aws-cdk-lib": "2.201.0",
67+
"aws-cdk-lib": "2.219.0",
6868
"aws-iot-device-sdk": "^2.2.13",
6969
"aws-sdk": "^2.1501.0",
7070
"builtin-modules": "3.2.0",
@@ -74,7 +74,7 @@
7474
"ci-info": "^3.7.0",
7575
"colorette": "^2.0.19",
7676
"conf": "^10.2.0",
77-
"constructs": "10.3.0",
77+
"constructs": "10.4.2",
7878
"cross-spawn": "^7.0.3",
7979
"dendriform-immer-patch-optimiser": "^2.1.0",
8080
"dotenv": "^16.0.3",

packages/sst/src/credentials.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import path from "path";
2+
import { createRequire } from "module";
23
import type { AwsCredentialIdentityProvider } from "@aws-sdk/types";
34
import { fromNodeProviderChain } from "@aws-sdk/credential-providers";
45
import { GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts";
@@ -145,14 +146,23 @@ export function useAWSClient<C extends any>(
145146
}
146147

147148
export const useAWSProvider = lazy(async () => {
148-
const cdkToolkitUrl = await import.meta.resolve!("@aws-cdk/toolkit-lib");
149-
const cdkToolkitPath = new URL(cdkToolkitUrl).pathname;
150-
const { SdkProvider } = await import(
151-
path.resolve(cdkToolkitPath, "..", "api", "aws-auth", "sdk-provider.js")
152-
);
153-
const { IoHelper } = await import(
154-
path.resolve(cdkToolkitPath, "..", "api", "io", "private", "io-helper.js")
155-
);
149+
const require = createRequire(import.meta.url);
150+
const cdkToolkitPath = require.resolve("@aws-cdk/toolkit-lib");
151+
const { SdkProvider } = require(path.resolve(
152+
cdkToolkitPath,
153+
"..",
154+
"api",
155+
"aws-auth",
156+
"sdk-provider.js"
157+
));
158+
const { IoHelper } = require(path.resolve(
159+
cdkToolkitPath,
160+
"..",
161+
"api",
162+
"io",
163+
"private",
164+
"io-helper.js"
165+
));
156166
const project = useProject();
157167
return new SdkProvider(useAWSCredentialsProvider(), project.config.region!, {
158168
ioHelper: IoHelper.fromActionAwareIoHost({

packages/sst/src/iot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { IoTClient, DescribeEndpointCommand } from "@aws-sdk/client-iot";
22
import { useAWSClient, useAWSCredentials } from "./credentials.js";
33
import { VisibleError } from "./error.js";
4+
import { lazy } from "./util/lazy.js";
45

56
export const useIOTEndpoint = lazy(async () => {
67
const iot = useAWSClient(IoTClient);
@@ -25,7 +26,6 @@ import { Logger } from "./logger.js";
2526
import { randomUUID } from "crypto";
2627
import { useBootstrap } from "./bootstrap.js";
2728
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
28-
import { lazy } from "./util/lazy.js";
2929

3030
interface Fragment {
3131
id: string;

packages/sst/src/stacks/deploy.ts

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import path from "path";
2+
import { createRequire } from "module";
23
import { useBus } from "../bus.js";
34
import { ConfigOptions, useProject } from "../project.js";
45
import { useAWSClient, useAWSProvider } from "../credentials.js";
@@ -25,7 +26,11 @@ export async function publishAssets(stacks: CloudFormationStackArtifact[]) {
2526
await buildAndPublishAssets(deployment, stackArtifact);
2627
results[stackArtifact.stackName] = {
2728
isUpdate: cfnStack && cfnStack.StackStatus !== "REVIEW_IN_PROGRESS",
28-
params: await buildCloudFormationStackParams(deployment, stackArtifact, cdk),
29+
params: await buildCloudFormationStackParams(
30+
deployment,
31+
stackArtifact,
32+
cdk
33+
),
2934
};
3035
}
3136
return results;
@@ -121,7 +126,11 @@ export async function deploy(
121126
await deleteCloudFormationStack(stack.stackName);
122127
}
123128

124-
const stackParams = await buildCloudFormationStackParams(deployment, stack, cdk);
129+
const stackParams = await buildCloudFormationStackParams(
130+
deployment,
131+
stack,
132+
cdk
133+
);
125134
try {
126135
cfnStack && cfnStack.StackStatus !== "REVIEW_IN_PROGRESS"
127136
? await updateCloudFormationStack(stackParams)
@@ -248,14 +257,23 @@ async function addInUseExports(
248257
}
249258

250259
async function createCdkDeployments() {
251-
const cdkToolkitUrl = await import.meta.resolve!("@aws-cdk/toolkit-lib");
252-
const cdkToolkitPath = new URL(cdkToolkitUrl).pathname;
253-
const { Deployments } = await import(
254-
path.resolve(cdkToolkitPath, "..", "api", "deployments", "deployments.js")
255-
);
256-
const { IoHelper } = await import(
257-
path.resolve(cdkToolkitPath, "..", "api", "io", "private", "io-helper.js")
258-
);
260+
const require = createRequire(import.meta.url);
261+
const cdkToolkitPath = require.resolve("@aws-cdk/toolkit-lib");
262+
const { Deployments } = require(path.resolve(
263+
cdkToolkitPath,
264+
"..",
265+
"api",
266+
"deployments",
267+
"deployments.js"
268+
));
269+
const { IoHelper } = require(path.resolve(
270+
cdkToolkitPath,
271+
"..",
272+
"api",
273+
"io",
274+
"private",
275+
"io-helper.js"
276+
));
259277
const provider = await useAWSProvider();
260278
await useAWSProvider();
261279
const ioHelper = IoHelper.fromActionAwareIoHost({
@@ -300,7 +318,9 @@ async function buildCloudFormationStackParams(
300318
cdkOptions?: ConfigOptions["cdk"]
301319
) {
302320
const env = await deployment.envs.accessStackForMutableStackOperations(stack);
303-
const executionRoleArn = cdkOptions?.cloudFormationExecutionRole ?? await env.replacePlaceholders(stack.cloudFormationExecutionRoleArn);
321+
const executionRoleArn =
322+
cdkOptions?.cloudFormationExecutionRole ??
323+
(await env.replacePlaceholders(stack.cloudFormationExecutionRoleArn));
304324
const s3Url = stack
305325
.stackTemplateAssetObjectUrl!.replace(
306326
"${AWS::AccountId}",
@@ -337,7 +357,7 @@ async function getCloudFormationStack(stack: CloudFormationStackArtifact) {
337357
const client = useAWSClient(CloudFormationClient);
338358
try {
339359
const { Stacks: stacks } = await client.send(
340-
new DescribeStacksCommand({
360+
new DescribeStacksCommand({
341361
StackName: stack.stackName,
342362
})
343363
);

packages/sst/src/stacks/synth.ts

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { App } from "../constructs/App.js";
33
import { useProject } from "../project.js";
44
import { useAWSProvider, useSTSIdentity } from "../credentials.js";
55
import path from "path";
6+
import { createRequire } from "module";
67
import { VisibleError } from "../error.js";
78
import { Semaphore } from "../util/semaphore.js";
89
import { Configuration } from "../util/user-configuration.js";
@@ -23,17 +24,29 @@ export async function synth(opts: SynthOptions) {
2324
const { App } = await import("../constructs/App.js");
2425
const cxapi = await import("@aws-cdk/cx-api");
2526

26-
const cdkToolkitUrl = await import.meta.resolve!("@aws-cdk/toolkit-lib");
27-
const cdkToolkitPath = new URL(cdkToolkitUrl).pathname;
28-
const { IoHelper } = await import(
29-
path.resolve(cdkToolkitPath, "..", "api", "io", "private", "io-helper.js")
30-
);
31-
const { PluginHost } = await import(
32-
path.resolve(cdkToolkitPath, "..", "api", "plugin", "plugin.js")
33-
);
34-
const { provideContextValues } = await import(
35-
path.resolve(cdkToolkitPath, "..", "context-providers", "index.js")
36-
);
27+
const require = createRequire(import.meta.url);
28+
const cdkToolkitPath = require.resolve("@aws-cdk/toolkit-lib");
29+
const { IoHelper } = require(path.resolve(
30+
cdkToolkitPath,
31+
"..",
32+
"api",
33+
"io",
34+
"private",
35+
"io-helper.js"
36+
));
37+
const { PluginHost } = require(path.resolve(
38+
cdkToolkitPath,
39+
"..",
40+
"api",
41+
"plugin",
42+
"plugin.js"
43+
));
44+
const { provideContextValues } = require(path.resolve(
45+
cdkToolkitPath,
46+
"..",
47+
"context-providers",
48+
"index.js"
49+
));
3750
const project = useProject();
3851

3952
const cwd = process.cwd();

packages/sst/src/util/user-configuration.ts

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,34 @@
22
import * as os from "os";
33
import * as fs_path from "path";
44
import * as fs from "fs";
5+
import { createRequire } from "module";
56

67
export const PROJECT_CONFIG = "cdk.json";
78
export const USER_DEFAULTS = "~/.cdk.json";
89
const CONTEXT_KEY = "context";
910

10-
let cdkToolkitPath: string;
11-
try {
12-
const cdkToolkitUrl = await import.meta.resolve!("@aws-cdk/toolkit-lib");
13-
cdkToolkitPath = new URL(cdkToolkitUrl).pathname;
14-
} catch (e) {
15-
// Fallback for test environment where import.meta.resolve is not available
16-
const module = await import("module");
17-
const require = (module as any).createRequire(import.meta.url);
18-
cdkToolkitPath = require.resolve("@aws-cdk/toolkit-lib");
19-
}
20-
const { ToolkitError } = await import(cdkToolkitPath);
21-
const { Context, PROJECT_CONTEXT } = await import(
22-
fs_path.resolve(cdkToolkitPath, "..", "api", "context.js")
23-
);
24-
const { Settings } = await import(
25-
fs_path.resolve(cdkToolkitPath, "..", "api", "settings.js")
26-
);
27-
const { Tags } = await import(
28-
fs_path.resolve(cdkToolkitPath, "..", "api", "tags", "index.js")
29-
);
11+
const require = createRequire(import.meta.url);
12+
const cdkToolkitPath = require.resolve("@aws-cdk/toolkit-lib");
13+
const { ToolkitError } = require(cdkToolkitPath);
14+
const { Context, PROJECT_CONTEXT } = require(fs_path.resolve(
15+
cdkToolkitPath,
16+
"..",
17+
"api",
18+
"context.js"
19+
));
20+
const { Settings } = require(fs_path.resolve(
21+
cdkToolkitPath,
22+
"..",
23+
"api",
24+
"settings.js"
25+
));
26+
const { Tags } = require(fs_path.resolve(
27+
cdkToolkitPath,
28+
"..",
29+
"api",
30+
"tags",
31+
"index.js"
32+
));
3033

3134
export enum Command {
3235
LS = "ls",

0 commit comments

Comments
 (0)