sst 2.8.20 → 2.8.22

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/sst.js CHANGED
@@ -58,7 +58,7 @@ process.on("uncaughtException", (err) => {
58
58
  console.trace(err.stack);
59
59
  }
60
60
  console.log();
61
- console.log(`Need help with this error? Join the SST community on Discord ${blue(`https://sst.dev/discord`)}`);
61
+ console.log(`Need help with this error? Post it in #help on the SST Discord ${blue(`https://sst.dev/discord`)}`);
62
62
  process.exit(1);
63
63
  });
64
64
  process.on("beforeExit", () => { });
package/constructs/Job.js CHANGED
@@ -193,7 +193,7 @@ export class Job extends Construct {
193
193
  }
194
194
  const parsed = path.parse(result.handler);
195
195
  const importName = parsed.ext.substring(1);
196
- const importPath = `./${path.join(parsed.dir, parsed.name)}.mjs`;
196
+ const importPath = `./${path.posix.join(parsed.dir, parsed.name)}.mjs`;
197
197
  await fs.writeFile(path.join(result.out, "handler-wrapper.mjs"), [
198
198
  `console.log("")`,
199
199
  `console.log("//////////////////////")`,
@@ -244,19 +244,18 @@ export class Job extends Construct {
244
244
  ]);
245
245
  }
246
246
  createLocalInvoker() {
247
- const { handler, nodejs } = this.props;
248
247
  // Note: make the invoker function the same ID as the Job
249
248
  // construct so users can identify the invoker function
250
249
  // in the Console.
251
250
  const fn = new Function(this, this.node.id, {
252
- handler,
253
- nodejs,
254
251
  runtime: "nodejs16.x",
255
- timeout: 10,
252
+ timeout: "15 minutes",
256
253
  memorySize: 1024,
257
254
  environment: {
255
+ ...this.props.environment,
258
256
  SST_DEBUG_TYPE: "job",
259
257
  },
258
+ ...this.props,
260
259
  });
261
260
  fn._doNotAllowOthersToBind = true;
262
261
  return fn;
@@ -238,8 +238,8 @@ export declare class SsrSite extends Construct implements SSTConstruct {
238
238
  certificate: ICertificate | undefined;
239
239
  } | undefined;
240
240
  /**
241
- * Attaches the given list of permissions to allow the Astro server side
242
- * rendering to access other AWS resources.
241
+ * Attaches the given list of permissions to allow the server side
242
+ * rendering framework to access other AWS resources.
243
243
  *
244
244
  * @example
245
245
  * ```js
@@ -158,8 +158,8 @@ export class SsrSite extends Construct {
158
158
  // Public Methods
159
159
  /////////////////////
160
160
  /**
161
- * Attaches the given list of permissions to allow the Astro server side
162
- * rendering to access other AWS resources.
161
+ * Attaches the given list of permissions to allow the server side
162
+ * rendering framework to access other AWS resources.
163
163
  *
164
164
  * @example
165
165
  * ```js
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.8.20",
4
+ "version": "2.8.22",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
package/project.js CHANGED
@@ -92,6 +92,12 @@ export async function initProject(globals) {
92
92
  const files = await fs.readdir(project.paths.root);
93
93
  for (const file of files) {
94
94
  if (file.startsWith(".sst.config")) {
95
+ // Do not remove recently generated config files. This allows for multiple
96
+ // SST processes to run concurrently.
97
+ const timeGenerated = (file.match(/\b\d{13}\b/g) ?? []).at(0);
98
+ if (timeGenerated && Date.now() - parseInt(timeGenerated, 10) < 30000) {
99
+ continue;
100
+ }
95
101
  await fs.unlink(path.join(project.paths.root, file));
96
102
  Logger.debug(`Removed old config file ${file}`);
97
103
  }
package/sst.mjs CHANGED
@@ -404,6 +404,10 @@ async function initProject(globals) {
404
404
  const files = await fs4.readdir(project.paths.root);
405
405
  for (const file2 of files) {
406
406
  if (file2.startsWith(".sst.config")) {
407
+ const timeGenerated = (file2.match(/\b\d{13}\b/g) ?? []).at(0);
408
+ if (timeGenerated && Date.now() - parseInt(timeGenerated, 10) < 3e4) {
409
+ continue;
410
+ }
407
411
  await fs4.unlink(path4.join(project.paths.root, file2));
408
412
  Logger.debug(`Removed old config file ${file2}`);
409
413
  }
@@ -3496,21 +3500,27 @@ var init_metadata = __esm({
3496
3500
  MetadataContext2 = Context.create(async () => {
3497
3501
  const bus = useBus();
3498
3502
  const cache = await useCache();
3499
- const data2 = await metadata2();
3500
- bus.publish("stacks.metadata", data2);
3501
3503
  bus.subscribe("stacks.metadata.updated", async () => {
3502
- const data3 = await metadata2();
3503
- await cache.write(`metadata.json`, JSON.stringify(data3));
3504
- bus.publish("stacks.metadata", data3);
3505
- MetadataContext2.provide(Promise.resolve(data3));
3504
+ const data2 = await metadata2();
3505
+ await cache.write(`metadata.json`, JSON.stringify(data2));
3506
+ bus.publish("stacks.metadata", data2);
3507
+ MetadataContext2.provide(Promise.resolve(data2));
3506
3508
  });
3507
3509
  bus.subscribe("stacks.metadata.deleted", async () => {
3508
- const data3 = await metadata2();
3509
- await cache.write(`metadata.json`, JSON.stringify(data3));
3510
- bus.publish("stacks.metadata", data3);
3511
- MetadataContext2.provide(Promise.resolve(data3));
3510
+ const data2 = await metadata2();
3511
+ await cache.write(`metadata.json`, JSON.stringify(data2));
3512
+ bus.publish("stacks.metadata", data2);
3513
+ MetadataContext2.provide(Promise.resolve(data2));
3512
3514
  });
3513
- return data2;
3515
+ while (true) {
3516
+ try {
3517
+ const data2 = await metadata2();
3518
+ bus.publish("stacks.metadata", data2);
3519
+ return data2;
3520
+ } catch {
3521
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
3522
+ }
3523
+ }
3514
3524
  });
3515
3525
  useMetadata = MetadataContext2.use;
3516
3526
  }
@@ -47965,7 +47975,7 @@ process.on("uncaughtException", (err) => {
47965
47975
  }
47966
47976
  console.log();
47967
47977
  console.log(
47968
- `Need help with this error? Join the SST community on Discord ${blue3(
47978
+ `Need help with this error? Post it in #help on the SST Discord ${blue3(
47969
47979
  `https://sst.dev/discord`
47970
47980
  )}`
47971
47981
  );
@@ -37,8 +37,6 @@ export async function metadata() {
37
37
  const MetadataContext = Context.create(async () => {
38
38
  const bus = useBus();
39
39
  const cache = await useCache();
40
- const data = await metadata();
41
- bus.publish("stacks.metadata", data);
42
40
  bus.subscribe("stacks.metadata.updated", async () => {
43
41
  const data = await metadata();
44
42
  await cache.write(`metadata.json`, JSON.stringify(data));
@@ -51,6 +49,15 @@ const MetadataContext = Context.create(async () => {
51
49
  bus.publish("stacks.metadata", data);
52
50
  MetadataContext.provide(Promise.resolve(data));
53
51
  });
54
- return data;
52
+ while (true) {
53
+ try {
54
+ const data = await metadata();
55
+ bus.publish("stacks.metadata", data);
56
+ return data;
57
+ }
58
+ catch {
59
+ await new Promise((resolve) => setTimeout(resolve, 1000));
60
+ }
61
+ }
55
62
  });
56
63
  export const useMetadata = MetadataContext.use;