fix: buffer archiver stream into Blob for native fetch/FormData compatibility#237
Open
Rohitbhise0004 wants to merge 3 commits intometacall:masterfrom
Open
fix: buffer archiver stream into Blob for native fetch/FormData compatibility#237Rohitbhise0004 wants to merge 3 commits intometacall:masterfrom
Rohitbhise0004 wants to merge 3 commits intometacall:masterfrom
Conversation
Protocol v0.1.28 replaced the axios-based ProtocolError (which had .response.status / .response.data) with a plain custom Error class that exposes .status and .data directly: Before: err.response?.status, err.response?.data After: err.status, err.data Fixes 10 ESLint errors: - src/cli/messages.ts: unsafe .response?.status and .response?.data access - src/auth.ts: 5x unsafe .response?.data access in auth flows
…tibility
@metacall/protocol >= 0.1.27 switched from axios to native fetch + FormData.
The upload() function now calls fd.append('raw', blob, 'blob') which requires
a Blob argument. The previous zip() returned a Node.js Transform stream
(Archiver) that native FormData cannot handle, causing a malformed multipart
body. The FaaS server's busboy then threw 'Unexpected end of form' and
returned HTTP 400.
Fix: collect all archiver data chunks into a Buffer and return it wrapped
in a Blob so it is compatible with native FormData.
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.
Problem
@metacall/protocol>= 0.1.27 switched fromaxiosto nativefetch+FormData. Theupload()function now calls:This requires a
Blobargument. Previously,zip()returned a Node.jsTransformstream (Archiver), which nativeFormData.append()cannot handle -- it corrupts or truncates the multipart body.The FaaS server's
busboythen throwsUnexpected end of formand returns HTTP 400, causing the CI integration tests to fail.Fix
Changed
zip()insrc/utils.tsto collect all archiver output chunks into aBufferand return it wrapped in aBlob:dataevents on the archiver to collect chunksarchive.finalize()and wait for theendeventnew Blob([Buffer.concat(chunks)], { type: 'application/zip' })Archivertype importThis is fully compatible with how
@metacall/protocolpasses the value toFormData.append().CI Error (before fix)