IPFS Cluster fails to POST to IPFS node

I was checking out twitter pinbot example.

I have a twitter bot and my cluster setup(cluster+ipfs daemons) is running on the same host as of the pinbot code.

I’m stuck at the step when I try to “add” something to the cluster, this error is thrown:

Post libp2p://Qmb8JM9b6h1Qt4nurpuooGLJfSxRpx6pjeqTyK1fRLsC1n/add?chunker=size-262144&cid-version=0&hash=sha2-256&hidden=false&layout=&name=Tweet-1214669464131629056&nocopy=false&progress=false&raw-leaves=false&recursive=false&replication-max=0&replication-min=0&shard=false&shard-size=104857600&stream-channels=true&user-allocations=&wrap-with-directory=true: context deadline exceeded (0)

Here is my config file:

  "twitter_name": "@simpleaswater_",
  "twitter_id": "@simpleaswater_",
  "consumer_key": <key>,
  "consumer_secret": <secret>,
  "access_key": <key>,
  "access_secret": <secret>,
  "cluster_peer_addr": "/ip4/",
  "cluster_username": "",
  "cluster_password": ""

Any clue why the dail fails?

Thanks :slight_smile:

1 Like

I see you are using 9096 but the twitter-bot as it is does not allow to configure the cluster secret to access the libp2p-HTTP API on that endpoint, so unless you have no cluster secret, that would not work. Also, the libp2p-HTTP-API on 9096 is only enabled in Raft-mode.

What I do is to configure an extra libp2p host for the API (by setting libp2p_listen_multiaddress, id and private_key (generate new ones, don’t re-use the main ones) in the restapi config section: https://cluster.ipfs.io/documentation/reference/configuration/#restapi) and then point the twitter bot to that (for example on port 9097).

Alternatively, I think you can just set cluster_peer_addr to /ip4/ (the HTTP API address). Since you are running the bot locally with the peer there is not much gain in tunneling the API traffic through libp2p.

Finally. triple check that the address/port you use is reachable from the twitter bot (i.e. your peer is running, and you are not running things on separate docker containers or things like that).

Thanks! Got it working.

@vasa-develop, any details on how you fixed it, what failed? Might be useful if other users land on this post with a similar problem, even if it was something silly…

1 Like

Following your advice, I configured a new libp2p host for the API using the ipfs cluster docs.

So, basically I added 3 more fields( libp2p_listen_multiaddress , id and private_key) in restapi section of ipfs cluster config file.

And then pointed the twitter-bot to the new Libp2p host. And it worked like charm!

Also, I will write a detailed post on SimpleAsWater about building a pinbot. So, that would cover all this.

1 Like

Here is the post which goes through:

  • Understanding the Significance & Purpose of IPFS Cluster
  • Setting up an IPFS Cluster Network
  • Building the Twitter Bot and interacting with IPFS Cluster Network to “pin”, “unpin” & “add” stuff to IPFS Cluster by tweeting to the bot.
1 Like