fix: raise maxDuration to 300s, extend sitemap JS timeout to 240s - #2095
Open
Flotapponnier wants to merge 1 commit into
Open
fix: raise maxDuration to 300s, extend sitemap JS timeout to 240s#2095Flotapponnier wants to merge 1 commit into
Flotapponnier wants to merge 1 commit into
Conversation
SIGKILL (signal 9) was killing the function at 60s. The aggregate blob (4.25MB) exceeds Next.js Data Cache's 2MB cap, so unstable_cache never caches it and every request re-fetches from /api/aggregate (FETCH_TIMEOUT_MS = 65s > maxDuration = 60s). SIGKILL discards the buffered response -> 500. - maxDuration 60 -> 300: gives full build time on cold starts - JS timeout 55s -> 240s: allows aggregate fetch + HL-builder Prometheus sweeps to finish before falling back to the static sitemap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Vercel logs confirm
Node.js process exited with signal: 9 (SIGKILL)on every/sitemap.xmlrequest since ~Aug 8.The sequence:
unstable_cacheinloadAggregateFromBlobcan't store the 4.25 MB blob (Next.js Data Cache hard cap is 2 MB), confirmed by repeated log warnings:items over 2MB can not be cached (4252793 bytes)/api/aggregate(no caching possible)/api/aggregatefetches from the Paris VPS — cold fetches take 18-65 s (FETCH_TIMEOUT_MS = 65_000)maxDuration = 60→ Vercel sends SIGKILL at 60 s before the fetch can resolveThe prior JS timeout at 55 s was designed to fire before SIGKILL and return the static fallback, but the background
buildFullSitemap()promise (holding the open 65 s fetch) kept the event loop alive past 60 s, preventing clean exit.Fix
maxDuration60 → 300: gives the function time to either complete the full build or exit cleanly after the JS timeout firesWhat to do after merging
The workflow file (
.github/workflows/prod-deploy.yml) also needs/api/aggregateadded to the warm-up step so the ISR cache is hot before the smoke test. That requiresworkflowscope on the push token — do it as a follow-up or re-auth withgh auth refresh -h github.com -s workflow.Test plan
🤖 Generated with Claude Code