fix(replay): Set text/javascript MIME type on compression worker Blob#22377
Open
billyvg wants to merge 1 commit into
Open
fix(replay): Set text/javascript MIME type on compression worker Blob#22377billyvg wants to merge 1 commit into
billyvg wants to merge 1 commit into
Conversation
billyvg
added a commit
that referenced
this pull request
Jul 17, 2026
Contributor
size-limit report 📦
|
The compression worker is created from a Blob URL, but the Blob was constructed without a MIME type, so it defaulted to an empty type. Safari (especially on iOS) validates the MIME type before executing a Blob as a classic Worker and silently rejects a non-JS type, firing a bare `error` event with no message — surfaced by the SDK as "Failed to load Replay compression worker: Unknown error". Blink/Gecko are lenient here, so this only manifests on Safari. Tagging the Blob `text/javascript` lets the worker load across browsers.
billyvg
force-pushed
the
bv/fix-replay-worker-safari-mime
branch
from
July 17, 2026 21:20
52b463b to
4d2c632
Compare
Member
Author
|
@sentry review |
billyvg
marked this pull request as ready for review
July 17, 2026 21:30
billyvg
requested review from
logaretm and
msonnb
and removed request for
a team
July 17, 2026 21:30
logaretm
approved these changes
Jul 18, 2026
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.
tbh I can't find a URL that says safari is more prone to not load a worker blob if it doesn't have a MIME type, but seems reasonable to add one.
Slop
getWorkerURL()builds the Replay compression worker from aBlobURL, but theBlobwas created without a MIME type, so it defaulted to an empty type. Safari (especially on iOS) validates the MIME type before executing aBlobas a classicWorkerand silently rejects a non-JS type — firing a bareerrorevent with no message, which the SDK surfaces as:Blink/Gecko are lenient about the blob MIME type, so this particular failure mode is Safari-specific. Tagging the blob
text/javascriptis the standard cross-browser fix.This is a handled error — recording already falls back to the uncompressed buffer — so there is no user-facing behavior change beyond the worker actually loading on Safari.
Testing
packages/replay-worker/test/unit/getWorkerURL.test.tsasserts the blob is created with thetext/javascriptMIME type.oxlint+oxfmtclean;replay-workersuite passes.Notes
This is the low-risk half of a split. A separate follow-up PR handles the cross-browser (Chrome/Edge/Firefox) occurrences of the same captured error, which come from the worker fetch being aborted during page navigation/teardown rather than from the MIME type. Follow-up to #19008, which introduced the descriptive error message but did not address the load failure itself.