Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module.exports = [
path: 'packages/browser/build/npm/esm/prod/index.js',
import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'feedbackIntegration'),
gzip: true,
limit: '98 KB',
limit: '99 KB',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

},
{
name: '@sentry/browser (incl. Feedback)',
Expand Down Expand Up @@ -208,7 +208,7 @@ module.exports = [
name: 'CDN Bundle (incl. Tracing, Replay)',
path: createCDNPath('bundle.tracing.replay.min.js'),
gzip: true,
limit: '80 KB',
limit: '81 KB',
},
{
name: 'CDN Bundle (incl. Tracing, Replay, Logs, Metrics)',
Expand Down
10 changes: 8 additions & 2 deletions packages/replay-internal/src/eventBuffer/WorkerHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export class WorkerHandler {
if ((data as WorkerResponse).success) {
resolve();
} else {
reject();
DEBUG_BUILD && debug.warn('Received worker message with unsuccessful status', data);
reject(new Error('Received worker message with unsuccessful status'));
}
},
{ once: true },
Expand All @@ -42,7 +43,12 @@ export class WorkerHandler {
this._worker.addEventListener(
'error',
error => {
reject(error);
DEBUG_BUILD && debug.warn('Failed to load Replay compression worker', error);
Copy link

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)

Fix in Cursor Fix in Web

reject(
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.'}`,
),
);
Copy link

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)

Fix in Cursor Fix in Web

},
{ once: true },
);
Expand Down
Loading