Skip to content

fix(sentry): filter stale app chunk load errors - #1327

Merged
tannerlinsley merged 3 commits into
mainfrom
seer/fix/sentry-filter-stale-app-errors
Oct 17, 2026
Merged

tannerlinsley merged 3 commits into
mainfrom
seer/fix/sentry-filter-stale-app-errors

Conversation

@sentry

@sentry sentry Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the frequent TypeError: error loading dynamically imported module errors reported to Sentry, specifically for assets like NavbarAuthControls-CAfKNbeY.js.

Problem: These errors are indicative of a "stale app" scenario (e.g., after a deployment or due to network issues), which installStaleAppReloadHandlers already attempts to mitigate by reloading the page. However, Sentry's global onerror handler captures these errors before the reload mechanism can fully suppress them, leading to unnecessary error reports.

Solution: The beforeSend function in src/router.tsx has been updated to include a check using isStaleAppError from src/utils/stale-app-reload.ts. If an event's exception matches the patterns for stale app errors, the event is now filtered out (by returning null), preventing it from being sent to Sentry.

This change ensures that Sentry only receives actionable errors, while the client-side page reload behavior for stale app errors remains unchanged.

Fixes TANSTACK-COM-2E2

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 688c0ca2-d9a5-46ca-b4ca-00862a763cba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com b092eed Commit Preview URL

Branch Preview URL
Oct 17 2026, 01:30 PM

@tannerlinsley

Copy link
Copy Markdown
Member

This also suppresses failures that the reload handler does not recover from. I ran an isolated fixture against the current stale-app-reload module with in-memory session storage and a counted reload function: the first matching chunk error returned true and reloaded, the immediate second error returned false because of the 10-second throttle, but the isStaleAppError predicate used here still returned true for it. beforeSend would therefore discard that second failure even though no recovery was attempted. Please tie suppression to an error actually handled by recovery, and retain reporting when reload is throttled. A regression covering both outcomes would help keep repeated broken deployments visible. This was a module-level fixture, not a browser deployment reproduction.

@changeset-bot

changeset-bot Bot commented Oct 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b092eed

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@tannerlinsley

Copy link
Copy Markdown
Member

I added the narrower recovery check in b092eed. The error that triggers a reload can be dropped, while a new failure during the 10-second cooldown still reaches Sentry.

AI review notes: The filter now consumes a receipt for the exact original error object instead of matching every chunk-error message. The regression uses the real Sentry BrowserClient with an in-memory transport and checks the first reload, a repeated observation of the same error, a new cooldown failure, an ordinary error, cooldown expiry, and a throwing reload. Strings and missing original exceptions remain reportable. This verifies the module and SDK pipeline, not a deployed browser recovery.

pnpm test passed: TypeScript and lint, 577 unit tests with 4 skipped, 2,270 chat tests, and 20 desktop tests with 1 skipped. Current main is merged into this branch. The new head still needs its own CI and required review before merging.

@tannerlinsley
tannerlinsley merged commit 053dc31 into main Oct 17, 2026
9 of 10 checks passed
@tannerlinsley
tannerlinsley deleted the seer/fix/sentry-filter-stale-app-errors branch October 17, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant