ipfs / ipfs-desktop

An unobtrusive and user-friendly desktop application for IPFS on Windows, Mac and Linux.
https://docs.ipfs.tech/install/ipfs-desktop/
MIT License
6.01k stars 865 forks source link

Doesn't work with Bandwidth Reporter disabled #893

Closed sergeevabc closed 5 years ago

sergeevabc commented 5 years ago

Windows 7 x64 -> ipfs-desktop-setup-0.7.2.exe

Tray icon says IPFS is running, but clicking upon Status/Files/Settings outputs Is your IPFS daemon running? Failed to connect to the API. However I see ipfs.exe within processes listed in Windows Task Manager.

I have read advices below such as “allow cross-origin”, but provided command ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["webui://-", "http://127.0.0.1:5001", "https://webui.ipfs.io"]' throws error “Error: Unknown Command "API.HTTPHeaders.Access-Control-Allow-Origin".

Thus, I’m confused.

hacdias commented 5 years ago

That's curious. I can't reproduce your issue on Windows 10. Have you changed any configuration/did you have a repository before installing IPFS Desktop? Or this is your first time installing IPFS?

sergeevabc commented 5 years ago

@hacdias, first time user, yes. Even turned off built-in Windows firewall just in case. It is regrettable there is no bootstrapping log to provide for easier troubleshooting since …\IPFS Desktop\logs is empty and other two log-like files contain vague information as follows.

$ cat combined.log
2019-04-02T09:30:39.950Z error: net::ERR_EMPTY_RESPONSE
2019-04-02T09:30:42.392Z info: [web ui] window ready
2019-04-02T09:30:42.393Z info: [tray] starting
2019-04-02T09:30:42.701Z info: [tray] started
2019-04-02T09:30:42.703Z info: [ipfsd] starting daemon
2019-04-02T09:30:51.425Z info: [ipfsd] daemon started
2019-04-02T09:30:51.529Z info: [hash download] shortcut disabled
2019-04-02T09:30:51.530Z info: [screenshot] shortcut disabled
2019-04-02T09:30:51.577Z info: [launch on startup] disabled
2019-04-02T09:31:41.689Z info: [web ui] navigate to /

$ cat error.log
2019-04-02T09:30:39.950Z error: net::ERR_EMPTY_RESPONSE
hacdias commented 5 years ago

Are you using Windows Subsystem for Linux? How did you run ipfs command if IPFS Desktop doesn't provide the CLI (yet)? You seem to already have IPFS running on your computer somehow.

sergeevabc commented 5 years ago

@hacdias, -_- My OS was stated clearly in the beginning, it is Windows 7, it has no Linux Subsystem. And I never run any ipfs commands via command-line interface. What I did is switched off IPFS Desktop, went to its logs folder and shared its contents with you.

hacdias commented 5 years ago

I have read advices below such as “allow cross-origin”, but provided command ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["webui://-", "http://127.0.0.1:5001", "https://webui.ipfs.io"]' throws error “Error: Unknown Command "API.HTTPHeaders.Access-Control-Allow-Origin".

How did you run that? We don't provide the ipfs CLI.

Could you try killing all ipfs-related processes in taskmgr and restart IPFS Desktop, please?

NatoBoram commented 5 years ago

Confirmed here, it doesn't work out of the box anymore.

OS: Windows 10 Pro x86_64
Host: System manufacturer
Kernel: 2.11.2(0.329/5/3)
Uptime: 11 hours, 21 mins
Shell: bash 4.4.23
Resolution: 1920x1080
DE: Aero
WM: Explorer
WM Theme: Roamed
CPU: Intel i5-3570K (4) @ 3.410GHz
GPU: NVIDIA GeForce GTX 660 Ti
Memory: 6411MiB / 8135MiB

image

Also, those two commands...

$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["webui://-", "http://127.0.0.1:5001", "https://webui.ipfs.io"]'
$ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'

Here's their output :

ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["webui://-", "http://127.0.0.1:5001", "https://webui.ipfs.io"]'
Error: Unknown Command "API.HTTPHeaders.Access-Control-Allow-Origin"

USAGE
  ipfs config <key> [<value>] - Get and set ipfs config values.

  ipfs config [--bool] [--json] [--] <key> [<value>]

  'ipfs config' controls configuration variables. It works like 'git config'.
  The configuration values are stored in a config file inside your ipfs
  repository.

SUBCOMMANDS
  ipfs config edit           - Open the config file for editing in $EDITOR.
  ipfs config profile        - Apply profiles to config.
  ipfs config replace <file> - Replace the config with <file>.
  ipfs config show           - Output config file contents.

Use 'ipfs config --help' for more information about this command.
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
Error: Unknown Command "API.HTTPHeaders.Access-Control-Allow-Methods"

USAGE
  ipfs config <key> [<value>] - Get and set ipfs config values.

  ipfs config [--bool] [--json] [--] <key> [<value>]

  'ipfs config' controls configuration variables. It works like 'git config'.
  The configuration values are stored in a config file inside your ipfs
  repository.

SUBCOMMANDS
  ipfs config edit           - Open the config file for editing in $EDITOR.
  ipfs config profile        - Apply profiles to config.
  ipfs config replace <file> - Replace the config with <file>.
  ipfs config show           - Output config file contents.

Use 'ipfs config --help' for more information about this command.

However, IPFS Companion's WebUI does work.

Here's the logs I've got :

Failed to connect to ipfs-api /ip4/127.0.0.1/tcp/5001
4.56d25521.chunk.js:1 Trying IPFS Companion
4.56d25521.chunk.js:1 🎛️ Customise your js-ipfs-api options by storing a `ipfsApi` object in localStorage. e.g. localStorage.setItem('ipfsApi', '/ip4/127.0.0.1/tcp/5001')
4.56d25521.chunk.js:1 Trying ipfs-api with custom api address /ip4/127.0.0.1/tcp/5001
bw:1 Failed to load resource: the server responded with a status of 503 (Connect failed)

Failed to connect to ipfs-api /ip4/127.0.0.1/tcp/5001
4.56d25521.chunk.js:1 Trying IPFS Companion
4.56d25521.chunk.js:1 🎛️ Customise your js-ipfs-api options by storing a `ipfsApi` object in localStorage. e.g. localStorage.setItem('ipfsApi', '/ip4/127.0.0.1/tcp/5001')
4.56d25521.chunk.js:1 Trying ipfs-api with custom api address /ip4/127.0.0.1/tcp/5001
4.56d25521.chunk.js:1 POST http://127.0.0.1:5001/api/v0/stats/bw?stream-channels=true 503 (Connect failed)

If I open the address in the failed POST, I get this :

{"TotalIn":1720,"TotalOut":1867,"RateIn":0.06946260261127944,"RateOut":0.07571170228100346}

I even deleted .ipfs and the result is still the same.

That's curious. I can't reproduce your issue on Windows 10.

Perhaps it's time for a fresh install?

hacdias commented 5 years ago

My steps:

Result:

image

Anything you think that might be causing this?

Also tried on my other Windows computer and it works just fine.


About the commands, yes, they seem not to be working on Windows. They were supposed to work though. It seems the command is not working on PowerShell, neither on CMD (source). I'll investigate this more.

NatoBoram commented 5 years ago

Ugh, what a pain. I have no idea what can cause this, I'm running a fresh build that I installed literally three days ago. Even in my old Windows installation, it stopped working a few weeks ago.

hacdias commented 5 years ago

Yeah, this is a weird situation. Do you know more or less in which version it stopped working? Did it stop working with an already existing IPFS repo?

NatoBoram commented 5 years ago

Nope. It just stopped working after an update. I tried both an existing repo and without a repo, with badgerds and flatfs, installed from Scoop and installed from the installer, and now from a fresh Windows 10 installation.

hacdias commented 5 years ago

I tried the exact same situations and didn't have any issue. Let's bring someone else! @djdv, could you please try to see if you can reproduce this issue? Thanks 😃

djdv commented 5 years ago

Okay so, without ipfs-desktop. I was unable to connect to the webui using my go-ipfs daemon, but these where unrelated (https://github.com/ipfs-shipyard/ipfs-webui/issues/1008, https://github.com/ipfs-shipyard/ipfs-webui/issues/1009) and already mentioned above. It had to do with my custom configuration.

I installed an instance of latest version of Windows (10 1903 18362.53), installed ipfs-desktop, and had no issues with a fresh profile. desktop

For people having the issue, can you open the ipfs-desktop status window, open the console (ctrl+shift+i), reload the page (ctrl+r), and see if you encounter any error similar to this: https://github.com/ipfs-shipyard/ipfs-webui/issues/1009

NatoBoram commented 5 years ago

Oh, that worked for me. I though I had enabled everything after creating the node, but it looks like it wasn't the case.

So... Shouldn't IPFS Desktop try to launch this command in the background if it can't connect to the node?

djdv commented 5 years ago

In my case, I went from a non-existing ipfs-config, and let ipfs-desktop initialize the profile. It seems like if you have an existing profile, nothing is modified. https://github.com/ipfs-shipyard/ipfs-desktop/blob/19a8793cc7e7b8ccbbce794fad46ca23fa450d00/src/utils/daemon.js#L55-L57

So currently, you either need a modern default config already, or you have to set those values yourself.

Shouldn't IPFS Desktop try to launch this command in the background if it can't connect to the node?

It seems like it would be useful to have an option that applies required settings to the config file. Basically a "Reset config" option during install, or a menu item under Advanced, etc. But imo we should not override the config values automatically, without prompting the user.

NatoBoram commented 5 years ago

So just adding that command to the interface, where the two others are, should be enough.

sergeevabc commented 5 years ago

@NatoBoram, “that command, that command”, let’s say it loud and clear: ipfs config --json Swarm.DisableBandwidthMetrics false

hacdias commented 5 years ago

Thanks for debugging this @djdv. I think that the best option is to show in Web UI some kind of message in this situations instead of blacking out. What do you think @olizilla?

We could, perhaps, make Web UI "tell" Desktop somehow of this issue, and ask the user their permission to automatically change the configuration instead of them doing it manually.

hacdias commented 5 years ago

Fixed on https://github.com/ipfs-shipyard/ipfs-webui/pull/1024 :smiley: