fix(frontend): stop reporting Directus network blips at error level - #1023
Open
posthog-eu[bot] wants to merge 2 commits into
Open
fix(frontend): stop reporting Directus network blips at error level#1023posthog-eu[bot] wants to merge 2 commits into
posthog-eu[bot] wants to merge 2 commits into
Conversation
The announcement React Query hooks captured each Directus failure inside the queryFn try/catch and rethrew. A query with `retry: 2` therefore reported the same failure up to three times, and a transient connectivity blip (fetch rejects with a TypeError) landed in error tracking at error level as pure noise. - Route capture through the existing global QueryCache / MutationCache error handlers, which fire once after retries are spent. - Add `requestErrorCapture`: a bare network blip becomes a low-severity event and stays out of error tracking; any other failure is captured as an exception. Both carry the request name and an offline flag. - Only requests that opt in with `meta.errorName` are captured, so the change does not widen capture to every query in the app. - Drop the now-redundant per-request try/catch (the mutations already toast in onError, so this also removes a double toast). Separately, emit build source maps and add a gated PostHog upload step to the dashboard deploy workflows, so future dashboard exceptions arrive symbolicated instead of as minified frames. Generated-By: PostHog Desktop Task-Id: e2bdde38-0dae-448d-80a9-63d27bfeff03
Removing the redundant per-mutation try/catch moved the `t` macro call sites, so the catalog source-location references drifted. Re-run extract and compile; only the `#:` references change, no msgids or translations. Generated-By: PostHog Desktop Task-Id: e2bdde38-0dae-448d-80a9-63d27bfeff03
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
dashboard.dembrane.comturned "TypeError: Failed to fetch" into error-level exceptions — network blips, not real failures. The failing request only feeds the announcement bar and sidebar inbox, so no core flow breaks; the cost is noise in error tracking.queryFntry/catch and rethrew. Withretry: 2, one offline moment reported the same failure up to three times.async queryFninassets/index-<hash>.js), because the dashboard build ships no source maps — so every dashboard exception is hard to place.Changes
Capture once, and below error level for network blips
Route capture through the existing global
QueryCache/MutationCacheonErrorhandlers, which fire once, after retries are spent.New
requestErrorCapturehelper classifies the failure:captureExceptionper attempt (up to 3×), error levelrequest_network_errorevent, out of error trackingcaptureExceptionper attemptcaptureException, tagged with request name + offline flagCapture only runs for requests that opt in with
meta.errorName, so this does not widen capture to every query in the app.Removes the now-redundant per-request try/catch. The mutations already toast in
onError, so this also removes a duplicate toast.Source maps for the dashboard build
build.sourcemap: truein the Vite config.PostHog/upload-source-mapsstep in the dev and prod dashboard deploy workflows. It is skipped until thePOSTHOG_CLI_API_KEYsecret is set, so it never blocks a deploy.Note
To activate the upload, add a
POSTHOG_CLI_API_KEYrepository secret (a personal API key witherror tracking write+organization read). Until then, maps are still emitted and publicly served, which already lets PostHog symbolicate the public dashboard bundle.Verification
tsc --noEmit,biome lint(0 errors), andvite build(58 maps emitted withsourceMappingURL) all pass.Agent context
Dembrane/echo(the dashboard frontend), not the site repo the task was filed against.meta.errorNameopt-in keeps the blast radius to the announcement hooks.Created with PostHog Desktop from this inbox report.