Skip to content

OUT-4146: set maxDuration on / page render to stop 15s SSR timeout - #283

Merged
SandipBajracharya merged 1 commit into
masterfrom
OUT-4146
Sep 2, 2026
Merged

OUT-4146: set maxDuration on / page render to stop 15s SSR timeout#283
SandipBajracharya merged 1 commit into
masterfrom
OUT-4146

Conversation

@SandipBajracharya

Copy link
Copy Markdown
Collaborator

Problem

Loading / when the QBO refresh token is stale triggers a token refresh during SSR (Home.tsxcheckPortalConnection). The / page render runs as a Vercel function, but page.tsx had no maxDuration export, so it fell back to Vercel's platform default (15s on Pro / 10s on Hobby) and threw a runtime timeout while the refresh was still in flight.

All API routes already set maxDuration = 300; only the page render was uncovered.

Change

  • src/app/page.tsx — add export const maxDuration = 300 so the page render gets the same 5-minute budget as the API routes.
  • src/app/api/quickbooks/setting/bank-account/route.ts — add the missing maxDuration = 300 (was uncommitted; same theme).

maxDuration is a Next.js Route Segment Config option and applies to any server-rendered segment (pages/layouts), not just route.ts.

Notes / follow-up

This raises the ceiling but doesn't fix the underlying slow refresh. The real issue is the silent-401 path where expired tokens hang instead of failing fast (tracked separately). Worth considering moving the connection check out of the RSC render into a client-triggered API call so it doesn't block first paint.

Test plan

  • Load / with a stale refresh token; confirm no 15s runtime timeout.
  • Verify normal / load and bank-account fetch still work.

🤖 Generated with Claude Code

The / page SSR (Home) refreshes QBO tokens, but page.tsx had no
maxDuration so it fell back to Vercel's 15s platform default and timed
out during refresh. Set it to 300 to match the API routes; also add the
missing maxDuration to the bank-account route.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Sep 2, 2026

Copy link
Copy Markdown

OUT-4146

@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
quickbooks-sync Building Building Sep 2, 2026 6:24am UTC
quickbooks-sync (dev) Ready Ready Preview Sep 2, 2026 6:24am UTC

Request Review

@SandipBajracharya SandipBajracharya changed the title fix(OUT-4146): set maxDuration on / page render to stop 15s SSR timeout OUT-4146: set maxDuration on / page render to stop 15s SSR timeout Sep 2, 2026
@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Greptile Summary

This PR raises the Vercel execution ceiling for the server-rendered dashboard and bank-account settings route so QuickBooks token refreshes and retries can finish instead of hitting the platform default timeout.

  • Adds a five-minute maxDuration to the root page render.
  • Adds the same execution limit to the bank-account settings endpoint.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

Both additions use a framework-supported route-segment option, match existing repository conventions, and are compatible with the bounded timeout and retry behavior of the affected QuickBooks operations.

Important Files Changed

Filename Overview
src/app/page.tsx Adds a supported route-segment execution limit consistent with the page’s server-side QuickBooks connection work.
src/app/api/quickbooks/setting/bank-account/route.ts Adds the established five-minute route limit so bounded QuickBooks refresh and account-query retries can complete.

Reviews (1): Last reviewed commit: "fix: set maxDuration on page render and ..." | Re-trigger Greptile

@SandipBajracharya
SandipBajracharya merged commit 0fb1265 into master Sep 2, 2026
6 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.

2 participants