OUT-4146: set maxDuration on / page render to stop 15s SSR timeout - #283
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis 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.
Confidence Score: 5/5The 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
Reviews (1): Last reviewed commit: "fix: set maxDuration on page render and ..." | Re-trigger Greptile |
priosshrsth
approved these changes
Sep 2, 2026
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.
Problem
Loading
/when the QBO refresh token is stale triggers a token refresh during SSR (Home.tsx→checkPortalConnection). The/page render runs as a Vercel function, butpage.tsxhad nomaxDurationexport, 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— addexport const maxDuration = 300so the page render gets the same 5-minute budget as the API routes.src/app/api/quickbooks/setting/bank-account/route.ts— add the missingmaxDuration = 300(was uncommitted; same theme).maxDurationis a Next.js Route Segment Config option and applies to any server-rendered segment (pages/layouts), not justroute.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
/with a stale refresh token; confirm no 15s runtime timeout./load and bank-account fetch still work.🤖 Generated with Claude Code