-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(replay): Improve error messages when compression worker fails to load #19008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
fix(replay): Improve error messages when compression worker fails to load #19008
Conversation
…load
Previously, when the compression worker failed to load (e.g., due to CSP
restrictions, network issues), Sentry captured a generic ErrorEvent with
almost no useful information ("Event: Event `Event` (type=error)").
This change wraps worker errors in descriptive Error objects that explain
what failed and common causes, making debugging significantly easier.
Fixes JAVASCRIPT-337J
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
size-limit report 📦
|
| new Error( | ||
| `Failed to load Replay compression worker: ${error instanceof ErrorEvent && error.message ? error.message : 'Unknown error. This can happen due to CSP policy restrictions, network issues, or the worker script failing to load.'}`, | ||
| ), | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test for improved error message regression fix
Low Severity · Bugbot Rules
This PR improves error messages when the compression worker fails to load, but no tests were added to verify the improved error messages are actually produced. The existing test at EventBufferProxy.test.ts only checks that the fallback buffer is used when the worker fails, not that the new descriptive Error objects are correctly constructed and rejected with the expected messages. Per the review rules: "When reviewing a fix PR, check if the PR includes at least one unit, integration or e2e test that tests the regression this PR fixes."
Additional Locations (1)
Co-authored-by: Andrei <168741329+andreiborza@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| 'error', | ||
| error => { | ||
| reject(error); | ||
| DEBUG_BUILD && debug.warn('Failed to load Replay compression worker', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant debug logging results in duplicate error messages
Low Severity
The new debug.warn calls at lines 36 and 46 are redundant because the caller EventBufferProxy._ensureWorkerIsLoaded() already logs these errors using debug.exception(). Looking at the logger implementation, debug.exception() logs both the message AND the error object to the console. This means when the worker fails to load, the same error appears multiple times in debug output - first as a warning from WorkerHandler, then as error logs from EventBufferProxy. The existing logging in EventBufferProxy provides more useful context (mentioning the fallback behavior), making the new logs unnecessary noise.
Additional Locations (1)
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
Previously, when the compression worker failed to load (e.g., due to CSP
restrictions, network issues), Sentry captured a generic ErrorEvent with
almost no useful information ("Event: Event
Event(type=error)").This change wraps worker errors in descriptive Error objects that explain
what failed and common causes, making debugging significantly easier.
Fixes JAVASCRIPT-337J
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com