Skip to content

fix: raise maxDuration on home page to avoid render timeout - #211

Merged
arpandhakal merged 2 commits into
mainfrom
fix/home-page-max-duration
Jun 11, 2026
Merged

fix: raise maxDuration on home page to avoid render timeout#211
arpandhakal merged 2 commits into
mainfrom
fix/home-page-max-duration

Conversation

@arpandhakal

Copy link
Copy Markdown
Collaborator

Changes

Adds export const maxDuration = 300 to src/app/(home)/page.tsx.

Why #209/#210 weren't enough

Those PRs raised maxDuration on the /api/users and /api/segments/stats API routes. But the home page render is a separate serverless function, and it awaits <UsersFetcher>, which makes an HTTP self-call to /api/users (same pattern for WorkspaceFetcher/BannerImagesFetcher). That page function had no maxDuration, so it stayed on the default 15s.

Result for large workspaces: /api/users now 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:

13:13:25 | GET | / | 200 | error | Vercel Runtime Timeout Error...

…while /api/users itself returned 200. 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:

  • Call the service directly instead of an HTTP self-call, and/or
  • Move the client-list fetch to client-side React Query so the page never blocks on it,
  • plus trimming the list payload (drop customFields).

This PR just stops the hard timeout/broken-UI.

Testing criteria

  • On a workspace with 10k+ clients, load the home page / preview — it renders without the "Vercel Runtime Timeout Error" / broken UI.
  • Smaller workspaces unaffected.
  • Loom:

Impact analysis

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
client-home-v3 Ready Ready Preview, Comment Jun 11, 2026 1:22pm

Request Review

@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds export const maxDuration = 300 to the Next.js home page route segment, raising the Vercel serverless function execution ceiling from the default 15s to 300s. It addresses a production timeout where the page function was being killed before UsersFetcher (an async Server Component making an HTTP self-call to /api/users) could complete on large workspaces.

  • Single-line config export on src/app/(home)/page.tsx — no logic changes; aligns the page function's limit with the 300s already set on /api/users and /api/segments/stats in prior PRs.
  • Stopgap acknowledged — the PR description correctly identifies the root cause (HTTP self-calls during SSR blocking the stream) and lists the proper long-term fixes; this change purely prevents the hard timeout/broken-UI failure in the meantime.

Confidence Score: 5/5

Safe 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

Filename Overview
src/app/(home)/page.tsx Adds export const maxDuration = 300 route segment config to prevent Vercel killing the page function while awaiting async server components that call /api/users; no logic changes.

Sequence Diagram

sequenceDiagram
    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
Loading

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>
@arpandhakal
arpandhakal merged commit 5e6bac9 into main Jun 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant