You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm testing Helia and I'm not able to get things I put into it out onto the IPFS.
I tried following the 301-networking.js example (which, FWIW, is fairly different than the example in the readme), but with no success. The code below will output two messages, Add image.jpg. with CID... and Added string with CID..., but if I plug those CIDs into ipfs.io (for example, this should be a string that says "Hey, suckas!"), the browser tries for a while and eventually times out.
From what I can tell by looking at the createHelia function, it doesn't look like I should need to provide a libp2p property to it, and it'll make one by itself with basically all the same stuff from the 301-networking.js example. Because of that, I'm not providing the libp2p property to the createHelia function like the examples suggest. I did try doing it that way, and still couldn't get the data to show up on the IPFS. Anyway, here's the code:
importfsfrom'fs';import{unixfs}from'@helia/unixfs';import{strings}from'@helia/strings';import{FsBlockstore}from'blockstore-fs';import{createHelia}from'helia';import{MemoryDatastore}from'datastore-core';constblockstore=newFsBlockstore('./blockstore');constdatastore=newMemoryDatastore();consthelia=awaitcreateHelia({
blockstore,
datastore,});constufs=unixfs(helia);conststr=strings(helia);constcid1=awaitufs.addBytes(Uint8Array.from(fs.readFileSync('./image.jpg')));console.log(`Added image.jpg with CID ${cid1} to the blockstore`);constcid2=awaitstr.add('Hey, suckas!');console.log(`Added string with CID ${cid2} to the blockstore`);
Saving that as helia..mjs and running it with node helia.mjs will spit out two console logs, but the CIDs that come back won't be accessible from the IPFS.
Because of my network configuration - I'm just using my laptop on my home internet connection - I've also tried manually configuring NAT/port forwarding stuff using the instructions from here, and still couldn't get anything working. Though with how all these libraries are changing, I wonder how valid those instructions are at this point.
All that being said, and for whatever it's worth, if I use the command line ipfs tool, I can add stuff to IPFS and it works great. Same computer, same internet connection, everything.
I appreciate any help and look forward to someone pointing out the incredibly simple and dumb thing I missed :-)
The text was updated successfully, but these errors were encountered:
@geoffoliver Thanks so much for your interest and in-depth explanation.
You should follow #182 for tracking the retrieval of Helia authored content from an IPFS gateway. Unfortunately, we're currently blocked on what you're trying to do.
As an aside, you should remember that content created on a node that turns off (you run a script, log CIDs, and then the script stops executing and no process is running) then your content is no longer available.
SgtPooki
changed the title
Unable to retrieve CID from IPFS after adding to Helia
Unable to retrieve CID from ipfs.io gateway after adding to Helia
Aug 10, 2023
Thanks for getting back to me :-) For what it's worth, my node would keep running after it console.logged out the CIDs, but thank you for the information. I'm looking forward to seeing all the cool stuff that happens with Helia!!
Node version: 18.15.0
OS: MacOS 14
Arch: M2
I'm testing Helia and I'm not able to get things I put into it out onto the IPFS.
I tried following the 301-networking.js example (which, FWIW, is fairly different than the example in the readme), but with no success. The code below will output two messages,
Add image.jpg. with CID...
andAdded string with CID...
, but if I plug those CIDs into ipfs.io (for example, this should be a string that says "Hey, suckas!"), the browser tries for a while and eventually times out.From what I can tell by looking at the
createHelia
function, it doesn't look like I should need to provide alibp2p
property to it, and it'll make one by itself with basically all the same stuff from the 301-networking.js example. Because of that, I'm not providing the libp2p property to thecreateHelia
function like the examples suggest. I did try doing it that way, and still couldn't get the data to show up on the IPFS. Anyway, here's the code:Saving that as
helia..mjs
and running it withnode helia.mjs
will spit out two console logs, but the CIDs that come back won't be accessible from the IPFS.Because of my network configuration - I'm just using my laptop on my home internet connection - I've also tried manually configuring NAT/port forwarding stuff using the instructions from here, and still couldn't get anything working. Though with how all these libraries are changing, I wonder how valid those instructions are at this point.
All that being said, and for whatever it's worth, if I use the command line
ipfs
tool, I can add stuff to IPFS and it works great. Same computer, same internet connection, everything.I appreciate any help and look forward to someone pointing out the incredibly simple and dumb thing I missed :-)
The text was updated successfully, but these errors were encountered: