sst 2.0.5 → 2.0.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.
@@ -96,6 +96,9 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
96
96
  setTimeout(() => {
97
97
  Colors.line(prefix(evt.properties.requestID), Colors.danger.bold("Error:"), Colors.danger.bold(evt.properties.errorMessage));
98
98
  for (const line of evt.properties.trace || []) {
99
+ // Skip double printing error message
100
+ if (line.includes(evt.properties.errorMessage))
101
+ continue;
99
102
  Colors.line(" ", `${dim(line)}`);
100
103
  }
101
104
  end(evt.properties.requestID);
package/constructs/RDS.js CHANGED
@@ -131,8 +131,12 @@ export class RDS extends Construct {
131
131
  },
132
132
  permissions: {
133
133
  "rds-data:*": [this.clusterArn],
134
- "secretsmanager:GetSecretValue": [this.secret.secretArn],
135
- "secretsmanager:DescribeSecret": [this.secret.secretArn],
134
+ "secretsmanager:GetSecretValue": [
135
+ this.secret.secretFullArn || `${this.secret.secretArn}*`,
136
+ ],
137
+ "secretsmanager:DescribeSecret": [
138
+ this.secret.secretFullArn || `${this.secret.secretArn}*`,
139
+ ],
136
140
  },
137
141
  };
138
142
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sst",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "bin": {
5
5
  "sst": "cli/sst.js"
6
6
  },
@@ -72,7 +72,10 @@ export const useNodeHandler = Context.memo(async () => {
72
72
  return fsSync.existsSync(file);
73
73
  });
74
74
  if (!file)
75
- throw new Error(`Cannot find a handler file for "${input.props.handler}"`);
75
+ return {
76
+ type: "error",
77
+ errors: [`Could not find file for handler ${input.props.handler}`],
78
+ };
76
79
  const nodejs = input.props.nodejs || {};
77
80
  const isESM = (nodejs.format || "esm") === "esm";
78
81
  const relative = path.relative(project.paths.root, path.resolve(parsed.dir));
package/sst.mjs CHANGED
@@ -4724,9 +4724,10 @@ var init_node = __esm({
4724
4724
  return fsSync2.existsSync(file2);
4725
4725
  });
4726
4726
  if (!file)
4727
- throw new Error(
4728
- `Cannot find a handler file for "${input.props.handler}"`
4729
- );
4727
+ return {
4728
+ type: "error",
4729
+ errors: [`Could not find file for handler ${input.props.handler}`]
4730
+ };
4730
4731
  const nodejs = input.props.nodejs || {};
4731
4732
  const isESM = (nodejs.format || "esm") === "esm";
4732
4733
  const relative = path10.relative(
@@ -6410,6 +6411,8 @@ var dev = (program2) => program2.command(
6410
6411
  Colors.danger.bold(evt.properties.errorMessage)
6411
6412
  );
6412
6413
  for (const line of evt.properties.trace || []) {
6414
+ if (line.includes(evt.properties.errorMessage))
6415
+ continue;
6413
6416
  Colors.line(" ", `${dim2(line)}`);
6414
6417
  }
6415
6418
  end(evt.properties.requestID);
@@ -13,8 +13,8 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
13
13
  return require.apply(this, arguments);
14
14
  throw new Error('Dynamic require of "' + x + '" is not supported');
15
15
  });
16
- var __commonJS = (cb, mod2) => function __require2() {
17
- return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
16
+ var __commonJS = (cb, mod) => function __require2() {
17
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
18
  };
19
19
  var __copyProps = (to, from, except, desc) => {
20
20
  if (from && typeof from === "object" || typeof from === "function") {
@@ -24,9 +24,9 @@ var __copyProps = (to, from, except, desc) => {
24
24
  }
25
25
  return to;
26
26
  };
27
- var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
28
- isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
29
- mod2
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
30
  ));
31
31
  var __publicField = (obj, key, value) => {
32
32
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -7685,13 +7685,13 @@ var require_client = __commonJS({
7685
7685
  var EMPTY_BUF = Buffer.alloc(0);
7686
7686
  async function lazyllhttp() {
7687
7687
  const llhttpWasmData = process.env.JEST_WORKER_ID ? require_llhttp_wasm() : void 0;
7688
- let mod2;
7688
+ let mod;
7689
7689
  try {
7690
- mod2 = await WebAssembly.compile(Buffer.from(require_llhttp_simd_wasm(), "base64"));
7690
+ mod = await WebAssembly.compile(Buffer.from(require_llhttp_simd_wasm(), "base64"));
7691
7691
  } catch (e) {
7692
- mod2 = await WebAssembly.compile(Buffer.from(llhttpWasmData || require_llhttp_wasm(), "base64"));
7692
+ mod = await WebAssembly.compile(Buffer.from(llhttpWasmData || require_llhttp_wasm(), "base64"));
7693
7693
  }
7694
- return await WebAssembly.instantiate(mod2, {
7694
+ return await WebAssembly.instantiate(mod, {
7695
7695
  env: {
7696
7696
  wasm_on_url: (p, at, len) => {
7697
7697
  return 0;
@@ -14347,12 +14347,12 @@ var require_filereader = __commonJS({
14347
14347
  }
14348
14348
  return this[kEvents].loadend;
14349
14349
  }
14350
- set onloadend(fn) {
14350
+ set onloadend(fn2) {
14351
14351
  if (!(this instanceof FileReader)) {
14352
14352
  throw new TypeError("Illegal invocation");
14353
14353
  }
14354
- if (typeof fn === "function") {
14355
- this[kEvents].loadend = fn;
14354
+ if (typeof fn2 === "function") {
14355
+ this[kEvents].loadend = fn2;
14356
14356
  } else {
14357
14357
  this[kEvents].loadend = null;
14358
14358
  }
@@ -14363,12 +14363,12 @@ var require_filereader = __commonJS({
14363
14363
  }
14364
14364
  return this[kEvents].error;
14365
14365
  }
14366
- set onerror(fn) {
14366
+ set onerror(fn2) {
14367
14367
  if (!(this instanceof FileReader)) {
14368
14368
  throw new TypeError("Illegal invocation");
14369
14369
  }
14370
- if (typeof fn === "function") {
14371
- this[kEvents].error = fn;
14370
+ if (typeof fn2 === "function") {
14371
+ this[kEvents].error = fn2;
14372
14372
  } else {
14373
14373
  this[kEvents].error = null;
14374
14374
  }
@@ -14379,12 +14379,12 @@ var require_filereader = __commonJS({
14379
14379
  }
14380
14380
  return this[kEvents].loadstart;
14381
14381
  }
14382
- set onloadstart(fn) {
14382
+ set onloadstart(fn2) {
14383
14383
  if (!(this instanceof FileReader)) {
14384
14384
  throw new TypeError("Illegal invocation");
14385
14385
  }
14386
- if (typeof fn === "function") {
14387
- this[kEvents].loadstart = fn;
14386
+ if (typeof fn2 === "function") {
14387
+ this[kEvents].loadstart = fn2;
14388
14388
  } else {
14389
14389
  this[kEvents].loadstart = null;
14390
14390
  }
@@ -14395,12 +14395,12 @@ var require_filereader = __commonJS({
14395
14395
  }
14396
14396
  return this[kEvents].progress;
14397
14397
  }
14398
- set onprogress(fn) {
14398
+ set onprogress(fn2) {
14399
14399
  if (!(this instanceof FileReader)) {
14400
14400
  throw new TypeError("Illegal invocation");
14401
14401
  }
14402
- if (typeof fn === "function") {
14403
- this[kEvents].progress = fn;
14402
+ if (typeof fn2 === "function") {
14403
+ this[kEvents].progress = fn2;
14404
14404
  } else {
14405
14405
  this[kEvents].progress = null;
14406
14406
  }
@@ -14411,12 +14411,12 @@ var require_filereader = __commonJS({
14411
14411
  }
14412
14412
  return this[kEvents].load;
14413
14413
  }
14414
- set onload(fn) {
14414
+ set onload(fn2) {
14415
14415
  if (!(this instanceof FileReader)) {
14416
14416
  throw new TypeError("Illegal invocation");
14417
14417
  }
14418
- if (typeof fn === "function") {
14419
- this[kEvents].load = fn;
14418
+ if (typeof fn2 === "function") {
14419
+ this[kEvents].load = fn2;
14420
14420
  } else {
14421
14421
  this[kEvents].load = null;
14422
14422
  }
@@ -14427,12 +14427,12 @@ var require_filereader = __commonJS({
14427
14427
  }
14428
14428
  return this[kEvents].abort;
14429
14429
  }
14430
- set onabort(fn) {
14430
+ set onabort(fn2) {
14431
14431
  if (!(this instanceof FileReader)) {
14432
14432
  throw new TypeError("Illegal invocation");
14433
14433
  }
14434
- if (typeof fn === "function") {
14435
- this[kEvents].abort = fn;
14434
+ if (typeof fn2 === "function") {
14435
+ this[kEvents].abort = fn2;
14436
14436
  } else {
14437
14437
  this[kEvents].abort = null;
14438
14438
  }
@@ -14515,7 +14515,7 @@ var require_undici = __commonJS({
14515
14515
  module.exports.createRedirectInterceptor = createRedirectInterceptor;
14516
14516
  module.exports.buildConnector = buildConnector;
14517
14517
  module.exports.errors = errors;
14518
- function makeDispatcher(fn) {
14518
+ function makeDispatcher(fn2) {
14519
14519
  return (url2, opts, handler) => {
14520
14520
  if (typeof opts === "function") {
14521
14521
  handler = opts;
@@ -14546,7 +14546,7 @@ var require_undici = __commonJS({
14546
14546
  if (agent) {
14547
14547
  throw new InvalidArgumentError("unsupported opts.agent. Did you mean opts.client?");
14548
14548
  }
14549
- return fn.call(dispatcher, {
14549
+ return fn2.call(dispatcher, {
14550
14550
  ...opts,
14551
14551
  origin: url2.origin,
14552
14552
  path: url2.search ? `${url2.pathname}${url2.search}` : url2.pathname,
@@ -14602,10 +14602,17 @@ var parsed = path.parse(input.handler);
14602
14602
  var file = [".js", ".jsx", ".mjs", ".cjs"].map((ext) => path.join(input.out, parsed.dir, parsed.name + ext)).find((file2) => {
14603
14603
  return fs.existsSync(file2);
14604
14604
  });
14605
- var mod;
14605
+ var fn;
14606
14606
  try {
14607
14607
  const { href } = url.pathToFileURL(file);
14608
- mod = await import(href);
14608
+ const mod = await import(href);
14609
+ const handler = parsed.ext.substring(1);
14610
+ fn = mod[handler];
14611
+ if (!fn) {
14612
+ throw new Error(
14613
+ `Function "${handler}" not found in "${input.handler}". Found ${Object.keys(mod).join(", ")}`
14614
+ );
14615
+ }
14609
14616
  } catch (ex) {
14610
14617
  await (0, import_undici.fetch)(`${input.url}/runtime/init/error`, {
14611
14618
  method: "POST",
@@ -14644,7 +14651,7 @@ while (true) {
14644
14651
  }
14645
14652
  global[Symbol.for("aws.lambda.runtime.requestId")] = context.awsRequestId;
14646
14653
  try {
14647
- response = await mod[parsed.ext.substring(1)](request, context);
14654
+ response = await fn(request, context);
14648
14655
  } catch (ex) {
14649
14656
  await (0, import_undici.fetch)(
14650
14657
  `${input.url}/runtime/invocation/${context.awsRequestId}/error`,