sst 2.5.6 → 2.5.7
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/commands/bind.js +17 -5
- package/credentials.js +1 -0
- package/package.json +2 -1
- package/sst.mjs +15 -5
package/cli/commands/bind.js
CHANGED
|
@@ -8,6 +8,7 @@ export const bind = (program) => program
|
|
|
8
8
|
.example(`sst bind "vitest run"`, "Bind your resources to your tests")
|
|
9
9
|
.example(`sst bind "tsx scripts/myscript.ts"`, "Bind your resources to a script"), async (args) => {
|
|
10
10
|
const { spawn } = await import("child_process");
|
|
11
|
+
const kill = await import("tree-kill");
|
|
11
12
|
const { useProject } = await import("../../project.js");
|
|
12
13
|
const { useBus } = await import("../../bus.js");
|
|
13
14
|
const { useIOT } = await import("../../iot.js");
|
|
@@ -112,7 +113,7 @@ export const bind = (program) => program
|
|
|
112
113
|
Colors.line(`\n`, `Your AWS session is about to expire. Creating a new session and restarting \`${command}\`...`);
|
|
113
114
|
bindSite("iam_expired");
|
|
114
115
|
}, expireAt - Date.now());
|
|
115
|
-
runCommand({
|
|
116
|
+
await runCommand({
|
|
116
117
|
...siteConfig.envs,
|
|
117
118
|
AWS_ACCESS_KEY_ID: credentials.AccessKeyId,
|
|
118
119
|
AWS_SECRET_ACCESS_KEY: credentials.SecretAccessKey,
|
|
@@ -122,14 +123,14 @@ export const bind = (program) => program
|
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
// Fallback to use local IAM credentials
|
|
125
|
-
runCommand({
|
|
126
|
+
await runCommand({
|
|
126
127
|
...siteConfig.envs,
|
|
127
128
|
...(await localIamCredentials()),
|
|
128
129
|
});
|
|
129
130
|
}
|
|
130
131
|
async function bindScript() {
|
|
131
132
|
const { Config } = await import("../../config.js");
|
|
132
|
-
runCommand({
|
|
133
|
+
await runCommand({
|
|
133
134
|
...(await Config.env()),
|
|
134
135
|
...(await localIamCredentials()),
|
|
135
136
|
});
|
|
@@ -234,10 +235,21 @@ export const bind = (program) => program
|
|
|
234
235
|
AWS_SESSION_TOKEN: credentials.sessionToken,
|
|
235
236
|
};
|
|
236
237
|
}
|
|
237
|
-
function runCommand(envs) {
|
|
238
|
+
async function runCommand(envs) {
|
|
238
239
|
Colors.gap();
|
|
239
240
|
if (p) {
|
|
240
|
-
p.
|
|
241
|
+
p.removeAllListeners("exit");
|
|
242
|
+
// Note: calling p.kill() does not kill child processes. And in the
|
|
243
|
+
// cases of Next.js and CRA, servers are child processes. Need to
|
|
244
|
+
// kill the entire process tree to free up port ie. 3000.
|
|
245
|
+
await new Promise((resolve, reject) => {
|
|
246
|
+
kill.default(p?.pid, (error) => {
|
|
247
|
+
if (error) {
|
|
248
|
+
return reject(error);
|
|
249
|
+
}
|
|
250
|
+
resolve(true);
|
|
251
|
+
});
|
|
252
|
+
});
|
|
241
253
|
}
|
|
242
254
|
p = spawn(command, {
|
|
243
255
|
env: {
|
package/credentials.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sst",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.7",
|
|
4
4
|
"bin": {
|
|
5
5
|
"sst": "cli/sst.js"
|
|
6
6
|
},
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"react": "18.2.0",
|
|
81
81
|
"remeda": "^1.3.0",
|
|
82
82
|
"sst-aws-cdk": "2.62.2-3",
|
|
83
|
+
"tree-kill": "^1.2.2",
|
|
83
84
|
"undici": "^5.12.0",
|
|
84
85
|
"uuid": "^9.0.0",
|
|
85
86
|
"ws": "^8.11.0",
|
package/sst.mjs
CHANGED
|
@@ -1601,6 +1601,7 @@ function useAWSClient(client, force = false) {
|
|
|
1601
1601
|
retryDecider: (e) => {
|
|
1602
1602
|
if (e.code === "ENOTFOUND") {
|
|
1603
1603
|
printNoInternet();
|
|
1604
|
+
return true;
|
|
1604
1605
|
}
|
|
1605
1606
|
if ([
|
|
1606
1607
|
"ThrottlingException",
|
|
@@ -7143,6 +7144,7 @@ var bind = (program2) => program2.command(
|
|
|
7143
7144
|
),
|
|
7144
7145
|
async (args) => {
|
|
7145
7146
|
const { spawn: spawn7 } = await import("child_process");
|
|
7147
|
+
const kill = await import("tree-kill");
|
|
7146
7148
|
const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
|
|
7147
7149
|
const { useBus: useBus2 } = await Promise.resolve().then(() => (init_bus(), bus_exports));
|
|
7148
7150
|
const { useIOT: useIOT2 } = await Promise.resolve().then(() => (init_iot(), iot_exports));
|
|
@@ -7270,7 +7272,7 @@ var bind = (program2) => program2.command(
|
|
|
7270
7272
|
);
|
|
7271
7273
|
bindSite("iam_expired");
|
|
7272
7274
|
}, expireAt - Date.now());
|
|
7273
|
-
runCommand({
|
|
7275
|
+
await runCommand({
|
|
7274
7276
|
...siteConfig.envs,
|
|
7275
7277
|
AWS_ACCESS_KEY_ID: credentials.AccessKeyId,
|
|
7276
7278
|
AWS_SECRET_ACCESS_KEY: credentials.SecretAccessKey,
|
|
@@ -7279,14 +7281,14 @@ var bind = (program2) => program2.command(
|
|
|
7279
7281
|
return;
|
|
7280
7282
|
}
|
|
7281
7283
|
}
|
|
7282
|
-
runCommand({
|
|
7284
|
+
await runCommand({
|
|
7283
7285
|
...siteConfig.envs,
|
|
7284
7286
|
...await localIamCredentials()
|
|
7285
7287
|
});
|
|
7286
7288
|
}
|
|
7287
7289
|
async function bindScript() {
|
|
7288
7290
|
const { Config: Config2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
7289
|
-
runCommand({
|
|
7291
|
+
await runCommand({
|
|
7290
7292
|
...await Config2.env(),
|
|
7291
7293
|
...await localIamCredentials()
|
|
7292
7294
|
});
|
|
@@ -7385,10 +7387,18 @@ var bind = (program2) => program2.command(
|
|
|
7385
7387
|
AWS_SESSION_TOKEN: credentials.sessionToken
|
|
7386
7388
|
};
|
|
7387
7389
|
}
|
|
7388
|
-
function runCommand(envs) {
|
|
7390
|
+
async function runCommand(envs) {
|
|
7389
7391
|
Colors2.gap();
|
|
7390
7392
|
if (p) {
|
|
7391
|
-
p.
|
|
7393
|
+
p.removeAllListeners("exit");
|
|
7394
|
+
await new Promise((resolve, reject) => {
|
|
7395
|
+
kill.default(p?.pid, (error2) => {
|
|
7396
|
+
if (error2) {
|
|
7397
|
+
return reject(error2);
|
|
7398
|
+
}
|
|
7399
|
+
resolve(true);
|
|
7400
|
+
});
|
|
7401
|
+
});
|
|
7392
7402
|
}
|
|
7393
7403
|
p = spawn7(command, {
|
|
7394
7404
|
env: {
|