Helia Example doesn't work

I am just following the Helia Example, Helia-101.
I cloned the repo. Installed the dependencies by running npm install. And modified the data which generates CID at this line. And once I have new CID, I am unable to retrieve the content from a gateway like ipfs.io.

Now I understand that my node is not accessible through the IPFS network. But as these are examples for beginners I expect them to show a warning or error stating that there is some issue and my node is not accessible.

How to resolve this ? Has anybody tried this before ? Is this to do with firewall ?


After the guide:

I was able to fetch my content from gateways.

But I still am not able to fetch content stored on IPFS with a in browser Helia node.
This is my CID: QmaypwhCRNyfLbZhNhvyBgjjPdkJVa4c5noUVuUUSLCc7p
I am able to fetch the file from a gateway. But not from a Helia Node, maybe I am doing something wrong. From the Helia Script tag example, I am running the following code block in browsers console, it doesn’t show anything, even after waiting for longer duration.

   async function catFile () {
        const textDecoder = new TextDecoder()
        for await (const data of heliaFs.cat('QmaypwhCRNyfLbZhNhvyBgjjPdkJVa4c5noUVuUUSLCc7p')) {
      await catFile()

I am not sure if a helia node is already connected to the Network by default or should some configuration be done so that it can fetch content from other nodes.

If possible please give me a minimal example where I enter a CID and get the contents of file. Thanks

1 Like

The exercise mentioned to retrieve data from a in browser Helia node, is also useful when you want the in browser Helia node to fetch content from the network. When you manually dial to the browser node from your native IPFS node, and your native IPFS node has that CID then the browser node is able to fetch it.
Still WebRTC is not completed rolled out it seems, and till WebRTC isn’t fully propogated throughout the IPFS network, a helia browser node won’t be able to fetch data from a native IPFS node. Or vice versa.

as @SgtPooki , I am unable to fetch data directly in a Helia node. According to what I observed it seems that fetching data is also not supported properly (I wasn’t able to fetch data in a browser helia node).

Fetching Helia authored content from gateways is not currently possible because gateways do not support webrtc, and cannot dial the nodes. The main issue tracking the resolution of this for Helia users is [🏆 Golden path scenario] Browser-authored contend retrievable by another machine through the ipfs.io gateway directly · Issue #182 · ipfs/helia · GitHub

As for fetching data from IPFS with Helia, this should not be a problem assuming your Helia node can make connections, and the provider of the CID has publicly diable addresses.

I tried accessing your content at https://ipfs.io/ipfs/QmaypwhCRNyfLbZhNhvyBgjjPdkJVa4c5noUVuUUSLCc7p and was successful,
and then tested accessing the CID using the helia-connectivity-demo at helia-connectivity-demo - CodeSandbox with the following code in the terminal:

 async function catFile () {
      const textDecoder = new TextDecoder()
      const results = []
      for await (const data of heliaFs.cat('QmaypwhCRNyfLbZhNhvyBgjjPdkJVa4c5noUVuUUSLCc7p')) {
        const piece = textDecoder.decode(data)
      return results
  const result = await catFile()

and am not getting any output.

So, I checked pl-diagnose to see who was providing that content at PL Diagnose and tested each peer and am failing to connect to those peers.

I also ran the following commands in the terminal and was unable to connect, nor find any publicly dialable multiaddrs:

# terminal 1
npx go-ipfs@latest daemon

# terminal 2
npx go-ipfs@latest dht findprovs 'QmaypwhCRNyfLbZhNhvyBgjjPdkJVa4c5noUVuUUSLCc7p' | xargs -tn1 npx go-ipfs@latest dht findpeer

Do you own the peers hosting this content?

  • /p2p/12D3KooWFmnC59awgtGqhqvJEGudahEbubfyEm6NQ4SvDUAEGJDv
  • /p2p/12D3KooWHz6LcQjfwzAuYFY6G5N7fi23T4YLsH6ZQH7NFg7bHyvW

If so, is your node publicly diable? I can’t seem to access it from my Kubo node, but ipfs.io can for some reason. @achingbrain or @adin might have better ideas about what’s happening.

1 Like

Like the OP, I’m unable to retrieve anything from IPFS using the helia-script-tag example.

For example, this sample CID given at Interplanetary File System (IPFS) · Cloudflare Web3 docs is retrievable via ipfs.io gateways:

But does not work using the Helia in-browser demo. Can anyone point to a working browser demo that retrieves content from IPFS?

@mwenge welcome to the forum!

Sorry for the delay in responding to you, what’s the issue you’re running into with helia-script-tag?

I have been playing with some demo code and slowly expanding it into a useful playground for various things I want to test with Helia at https://sgtpooki-helia-playground.on.fleek.co/ (code at GitHub - SgtPooki/helia-playground: just testing stuff with helia) and I am not able to successfully fetch QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy, but I am able to fetch CIDs that I have pinned on web3.storage.

The output of the “Fetch content” util is really messy right now but you can see entries confirming that helia gets the blocks and adds them to it’s blockstore:

bafyreigs4qq4w4lmjmqr7eagage77biquyb2qg5ptnhc4jc4uwfk4abrbi and bafybeiaxuasctnq3sgwwgtgdk6q2rlvuwe4s37bfzin7z7cnt6byesdpvq both return the following output:

bitswap:want-block:block: CID
bitswap:want-block:block: CID
blocks:get:blockstore:put: CID
NotAFileError: not a file

The Error there is just because i’m calling fs.cat(CID) on a CID that isn’t unixfs. If I were to use dag-cbor (or whatever appropriate codec), it would return the appropriate results.

Testing a unixfs image I have pinned at web3.storage, via CID bafybeien3lgc32mbdtjmggs6mssvic35ho5r7zavsutckkyo4qyn6jd7e4, breaks the page, but checking the console, you can see that we’re getting the actual content:


I have some improvements I want to make to helia-playground to actually render content more fully, but I think I want to abstract out the helia-fetch logic into a library first. The helia-fetch logic that can actually render some content can be found at GitHub - SgtPooki/helia-service-worker-gateway. You can see that helia can fetch and render the image correctly at https://helia-service-worker-gateway.on.fleek.co/ipfs/bafybeien3lgc32mbdtjmggs6mssvic35ho5r7zavsutckkyo4qyn6jd7e4

If you haven’t seen https://pl-diagnose.on.fleek.co/, I would highly recommend checking it out. I tried debugging your CID on pl-diagnose and wasn’t able to get to a success on " 4. Is my node serving the content?" even though the rest were successful. Maybe you will have better luck?

I was able to retrieve your content from my local kubo node though, with

> npx -y kubo dag get QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy

> npx -y kubo cat QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy
I'm trying out IPFS

I too am having issues retrieving a CID QmY43r3bw9pJc28iFet42kAzVmtFuoa39kuxd4q4SG2gpz . using the pl diagnose PL Diagnose

it returns to available peers, however fs.cat in networking 301 just hangs

@polus-arcticus one problem with fs.cat on that CID is that the CID is a directory. Using kubo and trying to cat the content results in Error: this dag node is a directory

with that said, I also could not fetch that content using Helia at https://sgtpooki-helia-playground.on.fleek.co/

1 Like