sst 2.0.6 → 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.
- package/cli/commands/dev.js +3 -0
- package/package.json +1 -1
- package/runtime/handlers/node.js +4 -1
- package/sst.mjs +6 -3
- package/support/nodejs-runtime/index.mjs +39 -32
package/cli/commands/dev.js
CHANGED
|
@@ -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/package.json
CHANGED
package/runtime/handlers/node.js
CHANGED
|
@@ -72,7 +72,10 @@ export const useNodeHandler = Context.memo(async () => {
|
|
|
72
72
|
return fsSync.existsSync(file);
|
|
73
73
|
});
|
|
74
74
|
if (!file)
|
|
75
|
-
|
|
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
|
-
|
|
4728
|
-
|
|
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,
|
|
17
|
-
return
|
|
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 = (
|
|
28
|
-
isNodeMode || !
|
|
29
|
-
|
|
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
|
|
7688
|
+
let mod;
|
|
7689
7689
|
try {
|
|
7690
|
-
|
|
7690
|
+
mod = await WebAssembly.compile(Buffer.from(require_llhttp_simd_wasm(), "base64"));
|
|
7691
7691
|
} catch (e) {
|
|
7692
|
-
|
|
7692
|
+
mod = await WebAssembly.compile(Buffer.from(llhttpWasmData || require_llhttp_wasm(), "base64"));
|
|
7693
7693
|
}
|
|
7694
|
-
return await WebAssembly.instantiate(
|
|
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(
|
|
14350
|
+
set onloadend(fn2) {
|
|
14351
14351
|
if (!(this instanceof FileReader)) {
|
|
14352
14352
|
throw new TypeError("Illegal invocation");
|
|
14353
14353
|
}
|
|
14354
|
-
if (typeof
|
|
14355
|
-
this[kEvents].loadend =
|
|
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(
|
|
14366
|
+
set onerror(fn2) {
|
|
14367
14367
|
if (!(this instanceof FileReader)) {
|
|
14368
14368
|
throw new TypeError("Illegal invocation");
|
|
14369
14369
|
}
|
|
14370
|
-
if (typeof
|
|
14371
|
-
this[kEvents].error =
|
|
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(
|
|
14382
|
+
set onloadstart(fn2) {
|
|
14383
14383
|
if (!(this instanceof FileReader)) {
|
|
14384
14384
|
throw new TypeError("Illegal invocation");
|
|
14385
14385
|
}
|
|
14386
|
-
if (typeof
|
|
14387
|
-
this[kEvents].loadstart =
|
|
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(
|
|
14398
|
+
set onprogress(fn2) {
|
|
14399
14399
|
if (!(this instanceof FileReader)) {
|
|
14400
14400
|
throw new TypeError("Illegal invocation");
|
|
14401
14401
|
}
|
|
14402
|
-
if (typeof
|
|
14403
|
-
this[kEvents].progress =
|
|
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(
|
|
14414
|
+
set onload(fn2) {
|
|
14415
14415
|
if (!(this instanceof FileReader)) {
|
|
14416
14416
|
throw new TypeError("Illegal invocation");
|
|
14417
14417
|
}
|
|
14418
|
-
if (typeof
|
|
14419
|
-
this[kEvents].load =
|
|
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(
|
|
14430
|
+
set onabort(fn2) {
|
|
14431
14431
|
if (!(this instanceof FileReader)) {
|
|
14432
14432
|
throw new TypeError("Illegal invocation");
|
|
14433
14433
|
}
|
|
14434
|
-
if (typeof
|
|
14435
|
-
this[kEvents].abort =
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
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`,
|