fix(frontend): handle transient network failures on downloadUrl path - #2902
Draft
posthog-eu[bot] wants to merge 1 commit into
Draft
fix(frontend): handle transient network failures on downloadUrl path#2902posthog-eu[bot] wants to merge 1 commit into
posthog-eu[bot] wants to merge 1 commit into
Conversation
A transient browser network drop on the bundle page's open/test button threw out of `downloadUrl` and escaped unhandled, so the user got no download and no toast. The same family of fetch TypeErrors (Chrome "Failed to fetch", WebKit "Load failed", Firefox "NetworkError when attempting to fetch resource.") also minted a fresh error-tracking issue per browser dialect. - Rethrow the original `TypeError` untouched in `downloadUrl` (wrap non-TypeError causes with `cause`) so transient-network detection can recognise the message. - Catch the `downloadUrl` call in `openVersion` so a failure lands in the existing `cannot-get-the-test-` toast instead of dead-ending. - Await `openVersion` at the bundle-page call site so the rejection is handled. - Suppress the transient browser network family in `before_send` via anchored patterns that don't swallow richer messages like "Failed to fetch org insights". Generated-By: PostHog Code Task-Id: 03e5605b-c50f-4db4-8829-b6d17c074e2d
|
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
Two error-tracking issues turned out to be one thing: a transient browser network drop on the
downloadUrlpath, worded differently per engine.TypeErrorthrew out ofdownloadUrl(supabase.ts) and escaped unhandled at the bundle-page call site, skipping straight past thecannot-get-the-test-toast written for exactly this case.Failed to fetch, WebKitLoad failed, FirefoxNetworkError when attempting to fetch resource., Edge, …) minted a fresh unhandled issue per browser dialect because nothing inbefore_sendmatched it.Mechanism of the fix:
TypeErroruntouched; wrap only non-TypeErrorcauses (withcause)src/services/supabase.tsdownloadUrlcall inopenVersionsrc/services/versions.tscannot-get-the-test-toast instead of dead-endingawait openVersion(...)at the call sitesrc/pages/app/[app].bundle.[bundle].vuebefore_sendsrc/services/staleAssetErrors.tsNote
Patterns are anchored (
^(?:.*: )?…$) so only the standalone browser message (optionally wrapped asdownloadUrl error: …) is suppressed — richer messages likeFailed to fetch organization insightsare left alone.Test plan
npx vitest run tests/stale-asset-errors.unit.test.ts— extended to cover the transient-network matcher (raw + wrapped forms), the non-matches, and end-to-end suppression viashouldSuppressPostHogExceptionEvent. All pass.vue-tsctypecheck clean on the touched files.Screenshots
n/a — the observable change is that a network blip now shows the existing "cannot get the test" toast instead of silently doing nothing.
Checklist
Agent context
Not covered by open PR #2891: that adds retries to
invokeCapgoApi(src/services/capgoApi.ts), butdownloadUrluses rawfetchand never goes through it, so this work does not overlap.Created with PostHog Desktop from this inbox report.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.