Skip to content

Commit feae958

Browse files
committed
fix(brief): bundle resvg linux-x64-gnu native binding with carousel fn
Real root cause of every Telegram carousel WEBPAGE_CURL_FAILED since PR #3174 merged. Not middleware (last PR fixed that theoretical path but not the observed failure). The Vercel function itself crashes HTTP 500 FUNCTION_INVOCATION_FAILED on every request including OPTIONS - the isolate can't initialise. The handler imports brief-carousel-render which lazy-imports @resvg/resvg-js. That package's js-binding.js does runtime require(@resvg/resvg-js-<platform>-<arch>-<libc>). On Vercel Lambda (Amazon Linux 2 glibc) that resolves to @resvg/resvg-js-linux-x64-gnu. Vercel nft tracing does NOT follow this conditional require so the optional peer package isnt bundled. Cold start throws MODULE_NOT_FOUND, isolate crashes, Vercel returns FUNCTION_INVOCATION_FAILED, Telegram reports WEBPAGE_CURL_FAILED. Fix: vercel.json functions.includeFiles forces linux-x64-gnu binding into the carousel functions bundle. Only this route needs it; every other api route is unaffected. Verified: - deploy-config tests 21/21 pass - JSON valid - Reproduced 500 via curl on all methods and UAs - resvg-js/js-binding.js confirms linux-x64-gnu is the runtime binary on Amazon Linux 2 glibc Post-merge: curl with TelegramBot UA should return 200 image/png instead of 500; next cron tick should clear the Railway [digest] Telegram carousel 400 line.
1 parent 135082d commit feae958

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

vercel.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"ignoreCommand": "bash scripts/vercel-ignore.sh",
33
"crons": [],
4+
"functions": {
5+
"api/brief/carousel/[userId]/[issueDate]/[page].ts": {
6+
"includeFiles": "node_modules/@resvg/resvg-js-linux-x64-gnu/**"
7+
}
8+
},
49
"redirects": [
510
{ "source": "/docs", "destination": "/docs/documentation", "permanent": false }
611
],

0 commit comments

Comments
 (0)