fix: support Blob file input for Bun compatibility#161
Open
fix: support Blob file input for Bun compatibility#161
Conversation
Bun's fetch cannot properly PUT a ReadableStream to S3 presigned URLs (it uses chunked transfer encoding instead of content-length). However, Bun.file() returns a lazy Blob that streams from disk and Bun's fetch handles it natively with proper content-length. This adds an instanceof Blob check in postSymbols: for Blob inputs, gzip magic bytes are validated via slice() instead of tee(), and the Blob is passed directly to fetch without stream manipulation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Blobsupport toGZippedSymbolFile.fileandUploadableFile.filetypesfile.fileis aBlob,postSymbolsvalidates gzip magic bytes viaslice(0, 2)instead oftee(), and passes the Blob directly to S3 uploadReadableStreampath is unchangedWhy
Bun's
fetchcannot properly PUT aReadableStreambody to S3 presigned URLs — it sends chunked transfer encoding instead of honoringcontent-length, which S3 rejects. However,Bun.file()returns a lazyBlobthat streams from disk, and Bun'sfetchhandles Blob bodies natively with propercontent-length. This enables@bugsplat/symbol-uploadto work with Bun-compiled executables.Test plan
🤖 Generated with Claude Code