Is ipfs cli tutorial outdated? adding object doesn't work

I am new to ipfs. I have a M1 mac. Started following the quickstart tutorial for ipfs cli. I was able to get the initial documentation and already started my ipfs node. The link I’m reading is the following one:

then it comes the part to create a very simple text file and adding it to ipfs and access it using the ipfs URL:


hash=`echo "I <3 IPFS -$(whoami)" | ipfs add -q`
echo $hash
QmWPAQ6pePdRh12219MTf74khnQjuRYDMSP53aNaH7cnCs
curl "https://ipfs.io/ipfs/$hash"
<html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>openresty</center>
</body>
</html>

Am I doing something wrong? Or is the documentation outdated?
Thanks in advance!

UPDATE: I used the web ui and added a file, but still not able to view it in the ipfs.io url (I copied the link from the share option found in the UI):
image

Maybe your node isn’t reachable (which would prevent ipfs.io from downloading the file from you).

Did a quick test. The content CID is in the DHT, but the node isn’t responding (as I suspected, I assume that’s your node):

> ipfs dht findprovs QmWPAQ6pePdRh12219MTf74khnQjuRYDMSP53aNaH7cnCs
12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp
> ipfs id 12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp
Error: failed to dial 12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp:
  * [/ip4/190.86.33.160/udp/13863/quic] timeout: no recent network activity
  * [/ip4/190.86.33.160/tcp/15694] dial tcp4 0.0.0.0:4001->190.86.33.160:15694: i/o timeout
> 

Thanks for replying!

Yes, at the moment you were testing my computer was suspended, but at the moment I tried to get the file, the daemon was up and running (otherwise the web UI wouldn’t be accessible).

I tried using the commands you posted (ipfs id) and it seems I get a correct output (I’m a newbie so I’m just following instructions); however using the public URL still returns a 504.

ipfs id 12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp
{
        "ID": "12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
        "PublicKey": "CAESIOqvwc5BN7vi17QA/ug8YNK2G8BaPnlh3hBrtJ01b2LV",
        "Addresses": [
                "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/127.0.0.1/udp/4001/quic/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/190.86.33.160/tcp/15694/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/190.86.33.160/udp/13863/quic/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/190.86.33.160/udp/32257/quic/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/192.168.1.18/tcp/4001/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/192.168.1.18/udp/4001/quic/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip6/::1/tcp/4001/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip6/::1/udp/4001/quic/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp"
        ],
        "AgentVersion": "go-ipfs/0.12.2/",
        "ProtocolVersion": "ipfs/0.1.0",
        "Protocols": [
                "/ipfs/bitswap",
                "/ipfs/bitswap/1.0.0",
                "/ipfs/bitswap/1.1.0",
                "/ipfs/bitswap/1.2.0",
                "/ipfs/id/1.0.0",
                "/ipfs/id/push/1.0.0",
                "/ipfs/lan/kad/1.0.0",
                "/ipfs/ping/1.0.0",
                "/libp2p/autonat/1.0.0",
                "/libp2p/circuit/relay/0.1.0",
                "/libp2p/circuit/relay/0.2.0/stop",
                "/p2p/id/delta/1.0.0",
                "/x/"
        ]
}

THanks for replying!

At the moment you tested, my computer was sleeping, that’s why. But when I posted the thread I had the daemon running and I was able to see the webui.

I used the command ipfs id you showed (not sure how it works but anyways) and I get a correct output (I guess). However I’m not able to access to it using the public URL (https://ipfs.io/ipfs/QmWPAQ6pePdRh12219MTf74khnQjuRYDMSP53aNaH7cnCs). This is the output I got while the daemon is running:

ipfs id 12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp
{
        "ID": "12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
        "PublicKey": "CAESIOqvwc5BN7vi17QA/ug8YNK2G8BaPnlh3hBrtJ01b2LV",
        "Addresses": [
                "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/127.0.0.1/udp/4001/quic/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/190.86.33.160/tcp/15694/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/190.86.33.160/udp/13863/quic/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/190.86.33.160/udp/32257/quic/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/192.168.1.18/tcp/4001/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip4/192.168.1.18/udp/4001/quic/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip6/::1/tcp/4001/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp",
                "/ip6/::1/udp/4001/quic/p2p/12D3KooWRcV1ZdN29Mhpk72Ci19PNUBqjyybCmGR29ZbzvE95Ptp"
        ],
        "AgentVersion": "go-ipfs/0.12.2/",
        "ProtocolVersion": "ipfs/0.1.0",
        "Protocols": [
                "/ipfs/bitswap",
                "/ipfs/bitswap/1.0.0",
                "/ipfs/bitswap/1.1.0",
                "/ipfs/bitswap/1.2.0",
                "/ipfs/id/1.0.0",
                "/ipfs/id/push/1.0.0",
                "/ipfs/lan/kad/1.0.0",
                "/ipfs/ping/1.0.0",
                "/libp2p/autonat/1.0.0",
                "/libp2p/circuit/relay/0.1.0",
                "/libp2p/circuit/relay/0.2.0/stop",
                "/p2p/id/delta/1.0.0",
                "/x/"
        ]
}

Try IPFS Check to see if it’s reachable.

Thanks for the suggestion.

I just tried using that tool and got this output:

❌ Could not connect to multiaddr: context deadline exceeded
✔ Found multiaddrs advertised in the DHT:
	/ip4/127.0.0.1/tcp/4001
	/ip4/127.0.0.1/udp/4001/quic
	/ip4/190.86.33.160/tcp/15694
	/ip4/190.86.33.160/udp/13863/quic
	/ip4/190.86.33.160/udp/32257/quic
	/ip4/192.168.1.18/tcp/4001
	/ip4/192.168.1.18/udp/4001/quic
	/ip6/::1/tcp/4001
	/ip6/::1/udp/4001/quic
✔ Found multihash adverised in the dht
❌ There was an error downloading the CID from the peer: could not connect to peer

I guess it seems my node is not reachable from outside? Do I need to expose it publicly somehow? My internet provider doesn’t assign me a public IP address, but I thought the ipfs daemon created a tunnel or something like that

Thank you for sharing this link! That helped me to understand what the issue was. I assumed the node was exposed automagically to the internet despite my network configuration. I ended up using ngrok and adding the exposed URL in the Announce addresses, using this tutorial: Hosting IPFS node with ngrok · GitHub
Now I’m able to see the file.

1 Like