Connecting CLI to Helia node fails with error

I have installed IPFS Kubo and tried connecting to the Helia node (nodejs application) via the following command:

ipfs --api /ip4/127.0.0.1/tcp/5022 id

where 5022 is the port Helia node is listening on. However, the above command throws multiple errors in no particular order. Following are the errors:

// error 1
http://127.0.0.1:<random_port> -> http://127.0.0.1:5022 - connection reset by peer

// error 2 with IPFS_LOGGING=debug
2023-06-21T14:02:13.513+0530    DEBUG   cmd/ipfs        ipfs/main.go:157        config path is /Users/<user>/.ipfs
Error: EOF

Following is the machine configuration:

Kubo version: 0.20.0
Repo version: 13
System version: arm64/darwin
Golang version: go1.19.8

What I want is a content gateway server powered by the Helia node. Following is the Helia configuration:

const blockstore = new MemoryBlockstore();
const datastore = new MemoryDatastore();
const libp2p = await createLibp2p({
    addresses: {
        listen: ["/ip4/0.0.0.0/tcp/5022"],
        announce: ["/ip4/0.0.0.0/tcp/5022"],
    },
    transports: [tcp()],
    connectionEncryption: [noise()],
    streamMuxers: [yamux()],
    peerDiscovery: [
	bootstrap({
	    list: [	 
           "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
           "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
           "/dnsaddr/bootstrap.libp2p.io/p2p/QmZa1sAxajnQjVM8WjWXoMbmPd7NsWhfKsPkErzpm9wGkp",
           "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",					 
           "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt"
         ],
    }),
  ],
});

const helia = await createHelia({
	datastore,
	blockstore,
	libp2p
});

IPFS CLI Configuration is the default one. Please let me know if you would like to take a look at that and I will post it.

can you show what command you are running to get that:

I am executing the following command:

ipfs --api /ip4/127.0.0.1/tcp/5022 id

I have noticed error 1 a few times in the terminal. Majority of the times, the error is always error 2. In both cases Helia node was running.

the listen port isn’t the API it’s a public P2P swarm port, I don’t understand what you are trying to do

1 Like