fix: raise maxDuration on home page to avoid render timeout - #211
Conversation
The home page render awaits <UsersFetcher>, which fetches the full client list via an HTTP self-call to /api/users. Raising maxDuration on /api/users (#209) was not enough: the page render function itself still defaulted to 15s, so for large workspaces it hit "Vercel Runtime Timeout Error" while awaiting the slow fetch, cutting the Suspense stream and breaking the UI. Raise the page's maxDuration to 300s to match. Confirmed in production logs: GET / -> "Vercel Runtime Timeout Error" while /api/users itself returned 200. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds
Confidence Score: 5/5Safe to merge — single-line route config change with no logic modifications. The change is a one-line Next.js route segment config export that raises the Vercel function execution ceiling on the home page, matching the 300s already in place on the API routes it depends on. No business logic, data handling, or auth paths are touched. The production logs and PR description provide clear evidence the fix addresses the real failure mode. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant PageFn as Home Page (Vercel Fn) maxDuration: 300s
participant UsersFn as /api/users (Vercel Fn) maxDuration: 300s
Browser->>PageFn: GET /
PageFn->>PageFn: render shell + HomeLayout immediately
PageFn->>UsersFn: HTTP self-call (UsersFetcher)
note over PageFn,UsersFn: Previously: page fn killed at 15s even though /api/users was allowed 300s
UsersFn-->>PageFn: "200 (may take >15s on large workspaces)"
PageFn-->>Browser: stream Suspense boundary resolved
Reviews (1): Last reviewed commit: "fix: raise maxDuration on home page to a..." | Re-trigger Greptile |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Changes
Adds
export const maxDuration = 300tosrc/app/(home)/page.tsx.Why #209/#210 weren't enough
Those PRs raised
maxDurationon the/api/usersand/api/segments/statsAPI routes. But the home page render is a separate serverless function, and itawaits<UsersFetcher>, which makes an HTTP self-call to/api/users(same pattern forWorkspaceFetcher/BannerImagesFetcher). That page function had nomaxDuration, so it stayed on the default 15s.Result for large workspaces:
/api/usersnow runs past 15s (allowed, 300s), but the page function awaiting it gets killed at 15s, cutting the Suspense stream and breaking the client UI.Confirmed in production logs:
…while
/api/usersitself returned200. Also note: it never reproduces locally (no function time limit), and axios has no client timeout configured, so the request just runs until the platform kills the function.Why this is still a stopgap
The underlying anti-pattern is fetching the full client list over an HTTP self-call during SSR and blocking the page render on it. The real fix:
customFields).This PR just stops the hard timeout/broken-UI.
Testing criteria
Impact analysis
🤖 Generated with Claude Code