fix(card): raise apply-for-card fetch timeout to 60s#2306
Merged
Conversation
The first-time Rain card application path is structurally 7-13s (7 sequential Sumsub calls + a 2.5s readiness sleep + Rain createApplication + optional inline issueCard). The global 10s fetchWithSentry default aborts that tail client-side while the backend keeps running to completion, so users see a false 'application failed' error on a card that was actually submitted. PostHog: the rain/cards timeout exception fires ~280x/week across ~40 distinct users; of 120 users who hit it in 30d only 28 reached card_apply_succeeded. Override timeoutMs for this one call only (browser-side fetch, so the 15s Vercel function ceiling that caps the global default does not apply here).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughIn ChangesRain card application timeout
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
Contributor
Code-analysis diffPainscore total: 5843.65 → 5843.8 (+0.15) 🆕 New findings (1)
✅ Resolved (1)
|
Contributor
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
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.
Why
The first-time Rain card application path (
POST /rain/cards) is structurally 7–13s:getCollectedDocTypes→getApplicant→moveToLevel×2 →checkRainReadiness→generateShareToken)setTimeout(2_500)readiness sleep (apply.ts:585) waiting for Sumsub's async review to flip GREENrainService.createApplication(Rain API)issueCardwhen Rain approves synchronouslyThe global 10s
fetchWithSentrydefault (src/utils/sentry.utils.ts) aborts that tail client-side while the backend keeps running to completion. The user sees a falsecard application failederror on a card application that was actually submitted — and a retry can resubmit.Impact (PostHog, prod)
rain/cards … timed out after 10000msexception fires ~280×/week across ~40 distinct users.card_apply_succeeded.Change
Override
timeoutMs: 60_000on theapplyForCardcall only. This is a browser→api.peanut.mefetch, so the "10s because Vercel's function limit is 15s" rationale that caps the global default does not apply here.rainRequestalready threadsopts.timeoutMs; nothing else changes.Not in scope (follow-up)
This is a band-aid. The durable fix is backend: parallelize the independent Sumsub calls and/or make issuance async (return
processing, finish via thecard_webhook_user_updatedpath) so users aren't blocked on a 13s spinner. Also worth confirmingcreateApplication/issueCardidempotency given the retry-after-timeout pattern.Risk
Low — single per-call timeout override, no behavior change on the happy path. Worst case a genuinely hung request now holds the spinner up to 60s instead of 10s before surfacing the same error.