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

IPFS Error while running on Google Compute Engine #4410

Closed
HernanPaez opened this issue Nov 21, 2017 · 5 comments
Closed

IPFS Error while running on Google Compute Engine #4410

HernanPaez opened this issue Nov 21, 2017 · 5 comments

Comments

@HernanPaez
Copy link

HernanPaez commented Nov 21, 2017

Version information:

go-ipfs version: 0.4.13-
Repo version: 6
System version: amd64/linux
Golang version: go1.9.2

Type:

Bug

Severity:

High

Description:

I'm trying to run IPFS on a Google Compute Engine Instance running a fresh install of Ubuntu 16.04. I already installed the linux prebuilt package but, when I first started the daemon I was not able to access the gateway. I fixed it by opening the 5001 tcp and udp ports but it don't connect to any node.

I tried by opening the following ports I found in another thread https://discuss.ipfs.io/t/ipfs-ports-firewall/996

TCP 4001 5001 8080 8081
UDP 4002/udp

I'm also seeing that the fields Peer ID, Location, Agent Version, Protocol Version, Public Key are empty in the webui

I'm also sending you my config file

  "API": {
    "HTTPHeaders": null
  },
  "Addresses": {
    "API": "/ip4/0.0.0.0/tcp/5001",
    "Announce": [],
    "Gateway": "/ip4/0.0.0.0/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001"
    ]
  },
  "Bootstrap": [
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
  "Reprovider": {
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
    "/dnsaddr/bootstrap.libp2p.io/ipfs/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
    "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
    "/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
    "/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
    "/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
    "/ip6/2604:a880:1:20::203:d001/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
    "/ip6/2400:6180:0:d0::151:6001/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
    "/ip6/2604:a880:800:10::4a:5001/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
    "/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd"
  ],
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": true,
      "Interval": 10
    }
  },
  "Experimental": {
    "FilestoreEnabled": false,
    "Libp2pStreamMounting": false,
    "ShardingEnabled": false
  },
  "Gateway": {
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range"
      ],
      "Access-Control-Allow-Methods": [
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    },
    "PathPrefixes": [],
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
    "PeerID": "QmYYSD3GP88wwMo9MTjM3vze8KR5p4AJfGVkSfUgCQZGqs"
  },
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "Reprovider": {
    "Interval": "12h",
    "Strategy": "all"
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {
      "GracePeriod": "20s",
      "HighWater": 900,
      "LowWater": 600,
      "Type": "basic"
    },
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "DisableRelay": false,
    "EnableRelayHop": false
  }
}

Also, I'm when I opened the javascript console (Firefox) I'm seeing this error on file ipfs-webui.0.3.0.js:12:31024

SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 5 of the JSON data
Stack trace:
r/<@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:14:30570
n@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:2:23902
r/<@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:17:30820
n.prototype.emit@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:2:366
E@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:55:24024
y@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:55:23115
n/<@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:2:7836
u.prototype.run@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:1:26073
s@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:1:25581
@Stebalien
Copy link
Member

Stebalien commented Nov 21, 2017

when I first started the daemon I was not able to access the gateway. I fixed it by opening the 5001 tcp and udp ports but it don't connect to any node.

  • The "gateway" runs on 8080.
  • The API and webui run on 5001.
  • IPFS uses 4001 to communicate with other peers by default.

I fixed it by opening the 5001 tcp and udp ports but it don't connect to any node.

Do you mean that your daemon isn't connecting to any other IPFS nodes? What command did you use to determine this?

Also, I'm when I opened the javascript console (Firefox) I'm seeing this error on file ipfs-webui.0.3.0.js:12:31024

Could you go to the network panel in the Firefox console and try to find the corresponding network request? Something isn't returning JSON that should be (or something on the network is messing with the connection).

@HernanPaez
Copy link
Author

HernanPaez commented Nov 21, 2017

The "gateway" runs on 8080.
The API and webui run on 5001.
IPFS uses 4001 to communicate with other peers by default.

Sorry, I opened multiple ports (4001, 5001, 8080, 8081) after that I was able to access the webui.

Do you mean that your daemon isn't connecting to any other IPFS nodes? What command did you use to determine this?

I checked on the connections sections on the webui. I'm going to upload my app and check if it can connect

Could you go to the network panel in the Firefox console and try to find the corresponding network request? Something isn't returning JSON that should be (or something on the network is messing with the connection).

Yeah, this is the network request:

SyntaxError
columnNumber: 30570
fileName: "http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js"
lineNumber: 14
message: "JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 5 of the JSON data"
stack: "r/<@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:14:30570\nn@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:2:23902\nr/<@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:17:30820\nn.prototype.emit@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:2:366\nE@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:55:24024\ny@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:55:23115\nn/<@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:2:7836\nu.prototype.run@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:1:26073\ns@http://104.196.10.137:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/ipfs-webui.0.3.0.js:1:25581\n"
__proto__: Object { stack: "", … }

I am attaching a screenshot of the webpage with the console log on firefox
captura de pantalla 2017-11-21 a la s 14 23 33

Checking with Google Chrome I also have some other errors (mostly 403 forbidden)
captura de pantalla 2017-11-21 a la s 14 27 51

@Stebalien
Copy link
Member

Stebalien commented Nov 21, 2017

Hm. This looks like a CORS issue: https://ethereum.stackexchange.com/questions/15778/ipfs-access-via-port-5001/15781

However, I strongly recommend that you don't expose the API to the internet unprotected. Make sure to protect it with something like a VPN.

I checked on the connections sections on the webui.

That's probably because the webui is having trouble talking to the daemon. If you can SSH into the machine, try running ipfs swarm peers.

Yeah, this is the network request

That's just a JavaScript error. The ultimate cause is a network request that's not returning JSON (in the "Network" panel).

Checking with Google Chrome I also have some other errors (mostly 403 forbidden)

That's may be related related. Could you click on the ":5001/api/..." part of that error, I believe it should show you the failed network request.

@Stebalien
Copy link
Member

Stebalien commented Nov 21, 2017

For now, let's move back to discourse. The underlying issue is probably CORS (not a bug) and the UI issue is ipfs/ipfs-webui#578.

@HernanPaez
Copy link
Author

HernanPaez commented Nov 21, 2017

Yes, I think this is a CORS Issue beacuse I tested the app and it is woking ok. The files are available

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

2 participants