IPFS fetching ERR_CONNECTION_TIMED_OUT do to fetch being stalled

I have an error that happens infrequently. After using my website where I fetch data from IPFS for a while and I refresh the page the fetch that’s initiated will stall and never retrieve the data and won’t retrieve the data no matter how many times I refresh unless I close out of the browser and relaunch it.

here is how I have my client set up:

import { create } from ‘ipfs-http-client’;
const auth = 'Basic ’ + Buffer.from(process.env.NEXT_PUBLIC_INFURA_PROJECTID + ‘:’ + process.env.NEXT_PUBLIC_INFURA_IPFS).toString(‘base64’);
const ipfs = create({
host: ‘ipfs.infura.io’,
port: 5001,
protocol: ‘https’,
apiPath: ‘/api/v0’,
headers: {
authorization: auth,


export default ipfs;

1 Like

Hi @hudsonhrh,

I can’t see any issue with the way your are instantiating the ipfs client. Your issue with the fetch after refreshing the page could be caused by any number of things. If you have a github repo and detailed steps to duplicate your environment then someone would be able to better help you.


instead of using the built in js fetch to the url I fetched this way instead which caused no error even after fetching multiple times in a row

async function fetchFromIpfs(ipfsHash) {
for await (const file of ipfs.cat(ipfsHash)) {
const stringData = new TextDecoder().decode(file);

    return JSON.parse(stringData);
1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.