Repository navigation
fix: prevent profile page hang from slow billing fetch - #1795
Merged
Merged
Conversation
The community profile edit page awaited the billing endpoint during page load. That endpoint makes 3-5 sequential external API calls (WorkOS + Stripe). When any of those hung, the entire page stayed on "Loading your profile..." forever — the root cause of escalation #176. Fixes: - Move billing fetch to background with 10s abort timeout so the page renders immediately - Move save payload construction inside try/catch so the save button can never get stuck at "Saving..." - Make populateMemberFields idempotent for the background billing callback Observability: - csrf.js now emits PostHog slow_api_call events when any fetch >3s (including timeouts/network errors with status 0) - New slow-response Express middleware logs warnings for API responses >3s and sends Slack alerts to ops channel for responses >10s - fetchPageDiagnostics utility for ad-hoc PostHog page error queries Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…angeset
- Remove fetchPageDiagnostics (dead code with HogQL injection risk)
- Replace res.end monkey-patch with res.on('finish') (type-safe, no deps)
- Static import for slack client instead of dynamic import per alert
- Remove duplicate member-profile timing middleware (covered by global)
- Fix LIKE wildcard injection (remove % from pathname allowlist)
- Add changeset
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…og path - populateMemberFields takes populateFormValues param: true on initial load, false on background billing callback (avoids overwriting checkbox state if user interacted between the two calls) - Drop raw req.path from log message template, use structured fields only Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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.
Summary
Fixes escalation #176: Community profile save page hangs indefinitely for member Sami Mokrani (Progmatic Motion). The billing endpoint (
/api/organizations/:orgId/billing) makes 3-5 sequential external API calls (WorkOS + Stripe) and was awaited during page load — when any of those hung, the entire page stayed on "Loading your profile..." forever.Changes
profile-edit.htmlpopulateMemberFieldscsrf.jsslow_api_callevents for any fetch >3s (including timeouts)slow-response.tshttp.tsposthog-query.tsfetchPageDiagnosticsutility for ad-hoc page error investigationTest plan
🤖 Generated with Claude Code