-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to upload to IPFS API: passing multiple files to ipfs.files.add sometimes fails #480
Comments
Upload via browser action fixed in #509 using workaround from ipfs/kubo#5168 (comment). Upstream bugs can be tracked at: ipfs/kubo#5168 and https://github.com/ipfs/js-ipfs-api/issues/797 |
Reopening. Chrome does not allow modification of
|
Good news! ipfs/kubo#5168 (comment) provides another workaround: send And guess what: Chrome does allow setting This means we have a workaround that works for both Firefox AND Chrome. Update: I checked Chrome docs and they do not include So it is unclear if this is a feature, but its safe to use it for now and fix uploads for Chrome users. Will PR shortly. |
Workaround for 'invalid Read on closed Body' in files.add (webext in Chrome) > Chrome does allow setting `Expect` via [`onBeforeSendHeaders`](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest/onBeforeSendHeaders) WebExtension API This means we now have a workaround for #480 that works in both Firefox and Chromium. Details: #480 (comment) & ipfs/kubo#5168 (comment) Closes #480
Background
I was playing with
ipfs.files.api
overjs-ipfs-api
andgo-ipfs
(PR #479) and noticed an odd edge case. Sometimes, for specific payloads, go-ipfs returns an error in the middle of payload:Then, upon receiving this response,
js-ipfs-api
does not throw an error, but silently ignores the last line and returns a partial result list with only two first items.How to reproduce
I was able to reproduce it with brand new (dockerized) node and latest Companion from #479, so I assume the bug is real, but would be great if someone else was able to reproduce and comment if they got the same result:
https://ipfs.io/ipfs/QmUGmyGCJEntjyxgcBmptkZ34k7PsgnCzXPoqwiWBDTK6L and save them on your disk
(I was able to reproduce the problem with ephemeral dockerized instance run via
docker run --rm -it -p 8080:8080 -p 4001:4001 -p 127.0.0.1:5001:5001 ipfs/go-ipfs:v0.4.15
)How to fix
Not sure yet, but there are two bugs at play:
http: invalid Read on closed Body
for some reasonFor now, Companion checks if result list has a proper count and displays an error if things are fishy, but it should be addressed upstream.
I am parking it for now and will pick up in spare time.
Until then, if anyone has any quick ideas, feel free to update this issue with any new findings.
The text was updated successfully, but these errors were encountered: