Fix preview app startup on Node 22 (Express 5 route syntax) (#2536)

Express was bumped 4.21.2 -> 5.2.1, whose router uses path-to-regexp v8 which removed inline-regex route params. The route /pull/:pr(\d+) threw PathError at startup. Switch to /pull/:pr (handler already validates with /^\d+\$/ and returns 400).

Also update deploy runtime to NODE:22-lts and drop the stray 'node' and unused top-level 'path-to-regexp' dependencies.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7793a516-0204-44e1-bed5-d8ad91b9400a
This commit is contained in:
jawelton74
2026-07-16 08:58:22 -07:00
committed by GitHub
parent 4a881651d5
commit cbac5f9a95
3 changed files with 4 additions and 32 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ const app = express();
app.use("/api", api);
app.use("/proxy", proxy);
app.use("/commit", commit);
app.get("/pull/:pr(\\d+)", (req, res) => {
app.get("/pull/:pr", (req, res) => {
const pr = req.params.pr;
if (!/^\d+$/.test(pr)) {
return res.status(400).send("Invalid pull request number");
+1 -27
View File
@@ -12,9 +12,7 @@
"express": "^5.2.1",
"follow-redirects": "^1.16.0",
"http-proxy-middleware": "^3.0.7",
"node": "^20.19.5",
"node-fetch": "^2.6.1",
"path-to-regexp": "^0.1.13"
"node-fetch": "^2.6.1"
}
},
"node_modules/@types/http-proxy": {
@@ -589,20 +587,6 @@
"node": ">= 0.6"
}
},
"node_modules/node": {
"version": "20.19.5",
"hasInstallScript": true,
"license": "ISC",
"dependencies": {
"node-bin-setup": "^1.0.0"
},
"bin": {
"node": "bin/node.exe"
},
"engines": {
"npm": ">=5.0.0"
}
},
"node_modules/node-fetch": {
"version": "2.6.7",
"license": "MIT",
@@ -621,10 +605,6 @@
}
}
},
"node_modules/node/node_modules/node-bin-setup": {
"version": "1.1.4",
"license": "ISC"
},
"node_modules/object-inspect": {
"version": "1.13.4",
"license": "MIT",
@@ -661,12 +641,6 @@
"node": ">= 0.8"
}
},
"node_modules/path-to-regexp": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
"integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
"license": "MIT"
},
"node_modules/picomatch": {
"version": "2.3.1",
"license": "MIT",
+2 -4
View File
@@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"deploy": "az webapp up --name \"dataexplorer-preview\" --subscription \"cosmosdb-portalteam-runners\" --resource-group \"dataexplorer-preview\" --runtime \"NODE:20-lts\" --sku P1V2",
"deploy": "az webapp up --name \"dataexplorer-preview\" --subscription \"cosmosdb-portalteam-runners\" --resource-group \"dataexplorer-preview\" --runtime \"NODE:22-lts\" --sku P1V2",
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
@@ -15,8 +15,6 @@
"express": "^5.2.1",
"follow-redirects": "^1.16.0",
"http-proxy-middleware": "^3.0.7",
"node": "^20.19.5",
"node-fetch": "^2.6.1",
"path-to-regexp": "^0.1.13"
"node-fetch": "^2.6.1"
}
}