fix(replay): Improve error messages when compression worker fails to load#19008
Conversation
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.
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)
| 'error', | ||
| error => { | ||
| reject(error); | ||
| DEBUG_BUILD && debug.warn('Failed to load Replay compression worker', error); |
There was a problem hiding this comment.
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.
|
2d55530 to
5db8e19
Compare
Codecov Results 📊✅ 538 passed | ⏭️ 49 skipped | Total: 587 | Pass Rate: 91.65% | Execution Time: 15m 7s All tests are passing successfully. Generated by Codecov Action |
…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>
Co-authored-by: Andrei <168741329+andreiborza@users.noreply.github.com>
83af4b8 to
a442dd3
Compare
There was a problem hiding this comment.
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.
| import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'feedbackIntegration'), | ||
| gzip: true, | ||
| limit: '98 KB', | ||
| limit: '99 KB', |
There was a problem hiding this comment.
Bundle size increase in browser package flagged
Low Severity
Per the review rules: "Large bundle size increases in browser packages. Sometimes they're unavoidable but flag them anyway." The size limit for @sentry/browser (incl. Tracing, Replay, Feedback) was bumped from 98 KB to 99 KB. The increase comes from the new descriptive error message strings added to WorkerHandler. This is likely unavoidable given the goal of improving error messages, but worth noting.


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