Skip to content
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

HTTPError: Bad Request when spawning go daemon inside electron process #502

Open
mistakia opened this issue Apr 26, 2020 · 3 comments
Open

Comments

@mistakia
Copy link

Getting an error when trying to run this in an electron renderer process and running the electron example produces the same errors.

HTTPError: Bad Request
    at HTTP.fetch (/Users/xxx/Projects/js-ipfsd-ctl/examples/electron-asar/node_modules/ipfsd-ctl/node_modules/ipfs-utils/src/http.js:147:13)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
    at async Client.init (/Users/xxx/Projects/js-ipfsd-ctl/examples/electron-asar/node_modules/ipfsd-ctl/src/ipfsd-client.js:88:17)
    at async Factory.spawn (/Users/xxx/Projects/js-ipfsd-ctl/examples/electron-asar/node_modules/ipfsd-ctl/src/factory.js:141:7)
    at async EventEmitter.<anonymous> (/Users/xxx/Projects/js-ipfsd-ctl/examples/electron-asar/app.js:27:18) {
  name: 'HTTPError',
  response: Response {
    size: 0,
    timeout: 0,
    [Symbol(Body internals)]: { body: [PassThrough], disturbed: false, error: null },
    [Symbol(Response internals)]: {
      url: 'http://localhost:43134/init?id=oY3V-7miM627hvksEMHlh',
      status: 400,
      statusText: 'Bad Request',
      headers: [Headers],
      counter: 0
    }
  }
}

versions

"ipfsd-ctl@file:../..":
  version "4.0.1"

"go-ipfs-dep@github:ipfs/npm-go-ipfs-dep#add-path-function-to-detect-binary":
  version "0.4.23"

ipfs-http-client@^38.2.0:
  version "38.2.1"
@achingbrain
Copy link
Member

achingbrain commented Apr 27, 2020

Can you try pinning the go-ipfs-dep version to 0.4.23-3 please? It's later than 0.4.23 but npm doesn't always resolve it as such.

Really it should have been released as 0.5.0 (or preferably 1.0.0) but for some reason people want to keep the version of that module tied to the go-ipfs version it downloads by default.

@mistakia
Copy link
Author

mistakia commented Apr 27, 2020

hmm - I have since resolved the issue in an electron project by looking at the ipfs-desktop implementation, which has go-ipfs-dep pinned at 0.4.23-3. The only material changes I made in my project are using the same versions being used in ipfs-desktop (go-ipfs-dep@0.4.23-3 ipfs-http-client@44.0.0 ipfsd-ctl@4.0.1) so I'm assuming that was part of the resolution.

However, I tried running the electron example with go-ipfs-dep@0.4.23-3 and got the same error 🤷‍♂️

Edit: I tried the latest version (4.1.0) of the electron example and am still getting the same error. Strange I'm not seeing this issue in any other projects lol.

@tymmesyde
Copy link

I think it's because of the remote option, you have to set it to false.
Apparently, it should automatically be set to false if it recognizes that it is in a node environment but does not seem to work.

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

No branches or pull requests

3 participants