I’m trying to upload files to IPFS but they all seem to fail. I am not running go-ipfs
. I am using Edge and Brave and Chrome. I’m building a Next.js app.
I create a node using create()
from ipfs-core
(v0.15.4). I am able to retrieve files using its CID from the browser that was used to upload it, but they can’t be found from another browser or using something like IPFS
When I try to upload something, I get a 500 server response like this:
https://node0.delegate.ipfs.io/api/v0/block/stat?timeout=30000ms&arg=QmSpztuwQfN3eRiL8o42ow3zHJuWu5HViCLud148BC8TyH
When I try to retrieve a file using its CID from a different browser, I get a 503 response like this:
https://node1.preload.ipfs.io/api/v0/refs?r=true&arg=QmSscRQ3EWsyBB7QHqGsbkzAhUctLH4Yo2scjzACCWeUzs
Any files uploaded from the current browser can be fetched, but anything uploaded using a different browser on the same computer remains pending indefinitely.
If any more information is needed please let me know.
You should maybe specify what you mean by different browser.
1 Like
So you are able to upload successfully with each browser - Edge, Chrome, Brave - and retrieve the file with it’s CID only if it was uploaded on it’s respective browser node?
That’s correct. I get a 500 error when I upload, so I think the file is cached in the browser node but fails to be shared with the public network. This is why the files uploaded using one browser can be fetched using its CID while files uploaded using another browser return 503 error codes.
I deleted my original comment after noticing you were running a Next.js app which may make a difference here as I’m not 100% sure on it’s exact implementation as far as configuring browser nodes in ipfs and there isn’t much reference documentation. I assume you’re running an example similiar to this one - js-ipfs-examples/examples/browser-nextjs at master · ipfs-examples/js-ipfs-examples · GitHub
Yes, that’s what I used, as well as creating a Context
to make it available across the whole app. I originally used:
if (globalThis.node) return
globalThis.node = create();
But that gave me the same outcome. I switched to the js-ipfs example to see if anything would be different.
From what I gather you’re using the default config profile node settings, in this case I think you’re correct in that the successful requests are working in their respective browsers because it’s fetching from the browser cache. Theoretically, the way the default profile is configured it’s supposed to work the way you’re expecting, but more than likely when attempting to fetch content from a browser different than the one that at least attempted the upload your request is timing out in attempts to locate the CID from a preload node, if it even were posted at all. Assuming this is no fault of your own due to some kind of bug in any custom code you’ve applied - there is likely too much traffic traversing the node causing the timeout, or the node is actually down. [link] The solution for this is to self-host your own delegate/preload nodes that the browser nodes can use to exchange content. [link]