@vercel/node 5.1.12 → 5.1.13
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/dist/dev-server.mjs +20 -14
- package/dist/index.js +0 -1
- package/package.json +2 -2
package/dist/dev-server.mjs
CHANGED
@@ -367,6 +367,7 @@ var init_helpers_web = __esm({
|
|
367
367
|
|
368
368
|
// src/dev-server.mts
|
369
369
|
import { join } from "path";
|
370
|
+
import { getLambdaOptionsFromFunction } from "@vercel/build-utils";
|
370
371
|
|
371
372
|
// src/edge-functions/edge-wasm-plugin.mts
|
372
373
|
import { createHash } from "crypto";
|
@@ -596,10 +597,9 @@ import { debug, streamToBuffer } from "@vercel/build-utils";
|
|
596
597
|
import { extname } from "path";
|
597
598
|
import { pathToRegexp as pathToRegexpCurrent } from "path-to-regexp";
|
598
599
|
import { pathToRegexp as pathToRegexpUpdated } from "path-to-regexp-updated";
|
599
|
-
var WAIT_UNTIL_TIMEOUT =
|
600
|
-
var
|
601
|
-
|
602
|
-
The function \`${entrypointPath.split("/").pop()}\` is still running after ${WAIT_UNTIL_TIMEOUT}s.
|
600
|
+
var WAIT_UNTIL_TIMEOUT = 30;
|
601
|
+
var waitUntilWarning = (entrypointPath, maxDuration) => `
|
602
|
+
The function \`${entrypointPath.split("/").pop()}\` is still running after ${maxDuration}s.
|
603
603
|
(hint: do you have a long-running waitUntil() promise?)
|
604
604
|
`.trim();
|
605
605
|
function entrypointToOutputPath(entrypoint2, zeroConfig) {
|
@@ -771,7 +771,7 @@ async function compileUserCode(entrypointFullPath, entrypointRelativePath, isMid
|
|
771
771
|
return void 0;
|
772
772
|
}
|
773
773
|
}
|
774
|
-
async function createEdgeRuntimeServer(params) {
|
774
|
+
async function createEdgeRuntimeServer(maxDuration, params) {
|
775
775
|
try {
|
776
776
|
if (!params) {
|
777
777
|
return void 0;
|
@@ -814,9 +814,9 @@ async function createEdgeRuntimeServer(params) {
|
|
814
814
|
};
|
815
815
|
const onExit2 = () => new Promise((resolve, reject) => {
|
816
816
|
const timeout = setTimeout(() => {
|
817
|
-
console.warn(waitUntilWarning(params.entrypointPath));
|
817
|
+
console.warn(waitUntilWarning(params.entrypointPath, maxDuration));
|
818
818
|
resolve();
|
819
|
-
},
|
819
|
+
}, maxDuration * 1e3);
|
820
820
|
Promise.all([params.awaiter.awaiting(), server.close()]).then(() => resolve()).catch(reject).finally(() => clearTimeout(timeout));
|
821
821
|
});
|
822
822
|
return { server, onExit: onExit2 };
|
@@ -826,13 +826,13 @@ async function createEdgeRuntimeServer(params) {
|
|
826
826
|
return void 0;
|
827
827
|
}
|
828
828
|
}
|
829
|
-
async function createEdgeEventHandler(entrypointFullPath, entrypointRelativePath, isMiddleware, isZeroConfig) {
|
829
|
+
async function createEdgeEventHandler(entrypointFullPath, entrypointRelativePath, isMiddleware, isZeroConfig, maxDuration = WAIT_UNTIL_TIMEOUT) {
|
830
830
|
const userCode = await compileUserCode(
|
831
831
|
entrypointFullPath,
|
832
832
|
entrypointRelativePath,
|
833
833
|
isMiddleware
|
834
834
|
);
|
835
|
-
const result = await createEdgeRuntimeServer(userCode);
|
835
|
+
const result = await createEdgeRuntimeServer(maxDuration, userCode);
|
836
836
|
const server = result?.server;
|
837
837
|
const onExit2 = result?.onExit;
|
838
838
|
const handler = async function(request) {
|
@@ -1133,7 +1133,7 @@ async function compileUserCode2(entrypointPath, awaiter, options) {
|
|
1133
1133
|
return listener(req, res);
|
1134
1134
|
};
|
1135
1135
|
}
|
1136
|
-
async function createServerlessEventHandler(entrypointPath, options) {
|
1136
|
+
async function createServerlessEventHandler(entrypointPath, options, maxDuration = WAIT_UNTIL_TIMEOUT) {
|
1137
1137
|
const awaiter = new Awaiter();
|
1138
1138
|
Object.defineProperty(globalThis, Symbol.for("@vercel/request-context"), {
|
1139
1139
|
enumerable: false,
|
@@ -1173,9 +1173,9 @@ async function createServerlessEventHandler(entrypointPath, options) {
|
|
1173
1173
|
};
|
1174
1174
|
const onExit2 = () => new Promise((resolve, reject) => {
|
1175
1175
|
const timeout = setTimeout(() => {
|
1176
|
-
console.warn(waitUntilWarning(entrypointPath));
|
1176
|
+
console.warn(waitUntilWarning(entrypointPath, maxDuration));
|
1177
1177
|
resolve();
|
1178
|
-
},
|
1178
|
+
}, maxDuration * 1e3);
|
1179
1179
|
Promise.all([awaiter.awaiting(), server.onExit()]).then(() => resolve()).catch(reject).finally(() => clearTimeout(timeout));
|
1180
1180
|
});
|
1181
1181
|
return {
|
@@ -1202,12 +1202,17 @@ async function createEventHandler(entrypoint2, config, options) {
|
|
1202
1202
|
const staticConfig = parseConfig(entrypointPath);
|
1203
1203
|
const runtime = staticConfig?.runtime;
|
1204
1204
|
validateConfiguredRuntime(runtime, entrypoint2);
|
1205
|
+
const { maxDuration } = await getLambdaOptionsFromFunction({
|
1206
|
+
sourceFile: entrypoint2,
|
1207
|
+
config
|
1208
|
+
});
|
1205
1209
|
if (config.middleware === true || isEdgeRuntime(runtime)) {
|
1206
1210
|
return createEdgeEventHandler(
|
1207
1211
|
entrypointPath,
|
1208
1212
|
entrypoint2,
|
1209
1213
|
config.middleware || false,
|
1210
|
-
config.zeroConfig
|
1214
|
+
config.zeroConfig,
|
1215
|
+
maxDuration
|
1211
1216
|
);
|
1212
1217
|
}
|
1213
1218
|
const content = await readFile(entrypointPath, "utf8");
|
@@ -1216,7 +1221,8 @@ async function createEventHandler(entrypoint2, config, options) {
|
|
1216
1221
|
);
|
1217
1222
|
return createServerlessEventHandler(entrypointPath, {
|
1218
1223
|
mode: isStreaming ? "streaming" : "buffer",
|
1219
|
-
shouldAddHelpers: options.shouldAddHelpers
|
1224
|
+
shouldAddHelpers: options.shouldAddHelpers,
|
1225
|
+
maxDuration
|
1220
1226
|
});
|
1221
1227
|
}
|
1222
1228
|
async function hasWebHandlers(getExports) {
|
package/dist/index.js
CHANGED
@@ -70084,7 +70084,6 @@ function pathToRegexp(callerId, path, keys, options) {
|
|
70084
70084
|
}
|
70085
70085
|
return currentRegExp;
|
70086
70086
|
}
|
70087
|
-
var WAIT_UNTIL_TIMEOUT_MS = 10 * 1e3;
|
70088
70087
|
function getRegExpFromMatchers(matcherOrMatchers) {
|
70089
70088
|
if (!matcherOrMatchers) {
|
70090
70089
|
return "^/.*$";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/node",
|
3
|
-
"version": "5.1.
|
3
|
+
"version": "5.1.13",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
|
@@ -17,7 +17,7 @@
|
|
17
17
|
"@edge-runtime/primitives": "4.1.0",
|
18
18
|
"@edge-runtime/vm": "3.2.0",
|
19
19
|
"@types/node": "16.18.11",
|
20
|
-
"@vercel/build-utils": "10.
|
20
|
+
"@vercel/build-utils": "10.5.0",
|
21
21
|
"@vercel/error-utils": "2.0.3",
|
22
22
|
"@vercel/nft": "0.27.10",
|
23
23
|
"@vercel/static-config": "3.0.0",
|