Grab latest ipfs-companion and ipfs-cluster.
For the purpose of this bug it can just run locally in ephemeral docker:
$ docker run -it --rm --net=host ipfs/ipfs-cluster
Try to upload with API port in Companion pointing at:
:5011) → OK:9095) → SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 2 column 1 of the JSON dataTL;DR is that companion uses js-ipfs-api (HTTP API Client library), and the library decides how to parse response payload based on additional HTTP headers.
Cluster does not seem to return X-Chunked-Output and that is why chunkedObjects in this line is false, which changes the flow and triggers parser error in streamToJsonValue.
@hsanjuan IIUC a fix would be to add X-Chunked-Output (and X-Stream-Error?) to ipfs-cluster's response to match what go-ipfs does.
See comparison below.
| go-ipfs | ipfs-cluster |
| ---- | ---- |
|
|
|
Will do @lidel ! Thanks
Re-tested and can confirm this was fixed works with Firefox and ipfs-cluster v0.7.0 :tada:
@lidel actually it's still broken with chrome because header gets stripped because CORs is not set correctly by cluster. :/
@hsanjuan hm.. this surfaces an interesting discrepancy between browser vendors.
I tested scenario where:
127.0.0.1:5001127.0.0.1:9095docker run -it --rm --net=host ipfs/ipfs-cluster:v0.7.0)127.0.0.1:9095 And.. quick upload in Firefox works fine even without CORS headers:
| :9095 in Firefox :angel: | :9095 in Chrome :anger: | :5001 in Chrome :angel: |
| ---- | ---- | ---- |
|
|
|
|
The inspector shows the X-Chunked-Output headers everywhere, but it Chrome Javascript doesn't see it unless the Access-Control-Expose-Headers is set accordingly. We'll have a better approach to headers in the proxy endpoint for the next release and fix this once and for all.
@lidel as of cluster 0.8.0-rc1 this is finally really fixed. Can be closed.
Confirmed with docker run -it --rm --net=host ipfs/ipfs-cluster:v0.8.0-rc1, works as expected :+1: