Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

examples/bundle-browserify fails when submitting data #972

Closed
autonome opened this issue Apr 16, 2019 · 7 comments
Closed

examples/bundle-browserify fails when submitting data #972

autonome opened this issue Apr 16, 2019 · 7 comments

Comments

@autonome
Copy link
Contributor

Error in the browser console:

13:11:21.276 ipfs add error Error: "Server responded with 405"
parseError http://127.0.0.1:8888/bundle.js:69499
onRes http://127.0.0.1:8888/bundle.js:69529
emit http://127.0.0.1:8888/bundle.js:3508
_connect http://127.0.0.1:8888/bundle.js:24929
_onFinish http://127.0.0.1:8888/bundle.js:24914
undefined bundle.js:13:22

Error from node:

[Tue Apr 16 2019 13:11:21 GMT-0700 (Pacific Daylight Time)] "POST /api/v0/add?stream-channels=true" Error (404): "Not found"

@alanshaw
Copy link
Contributor

Error from node

Not sure I understand - where are you seeing that error?

Can you tell me what IPFS node are you talking to (js-ipfs or go-ipfs) and what's in your IPFS config for API.HTTPHeaders.Access-Control-Allow-Origin?

Looking at the code for that example, I would guess you've spawned a JS IPFS node and the IPFS client is trying to connect to the API on 5001, but JS IPFS runs it's API on 5002 currently.

If that's it, the example just needs to be updated to try to fallback to 5002.

@alanshaw
Copy link
Contributor

The real solution is for JS IPFS to use the same ports as go-ipfs ipfs/js-ipfs#1563

@b-rohit
Copy link

b-rohit commented May 22, 2019

I use go-ipfs. I also face the same issue. I set the configs as given in the example

> ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"*\"]"
> ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials "[\"true\"]"

The error logs in browser are following

`POST http://127.0.0.1:8888/api/v0/add?stream-channels=true 405 (Method Not Allowed)
 Uncaught (in promise) Error: Server responded with 405
    at parseError (bundle.js:26702)
    at module.exports.<anonymous> (bundle.js:26744)
    at emitOne (bundle.js:19466)
    at module.exports.emit (bundle.js:19544)
    at module.exports.ClientRequest._connect (bundle.js:28862)
    at bundle.js:28847`

at server side the error message is
"POST /api/v0/add?stream-channels=true" Error (404): "Not found"

@b-rohit
Copy link

b-rohit commented May 22, 2019

I solved it. I made the following change
var ipfs = IPFS('/ip4/127.0.0.1/tcp/5001')

@elluck91
Copy link

elluck91 commented Jun 28, 2019

I solved it. I made the following change
var ipfs = IPFS('/ip4/127.0.0.1/tcp/5001')

This does not solve the problem for me. Any updates on that?

@alanshaw
Copy link
Contributor

@elluck91 did you figure it out? Have you setup CORS properly on your IPFS node? https://github.com/ipfs/js-ipfs-http-client#cors

@alanshaw
Copy link
Contributor

alanshaw commented Jul 10, 2019

Closing as I don't believe there's an issue here - this is just CORS configuration on the node that needs to be added/updated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants