Timing out when adding data to IPFS node

We are getting a lot of timeouts when trying to pin data to Infura’s ipfs endpoint via our dapps and are losing data in multiple cases.

Is there any background for what is going on and estimated time to resolution?

Sorry to hear you are having issues, can you provide the code for your requests and the full error response?

It used to work fine 1 week ago, and we haven’t changed any of our code. We are getting 504 gateway timeouts.

Reference code though:


Does that happen every time or is that occasional ? Could you provide the exact request that is made (cURL equivalent if possible) ?

@michael.mure this seems to happen like 50% of the time lately. It was not like this a week ago.

Here is what i get in the browser console when i trigger an ipfsGet action via https://github.com/AutarkLabs/planning-suite/blob/dev/apps/projects/app/utils/ipfs-helpers.js and https://github.com/AutarkLabs/planning-suite/blob/783a3f67e5657a6f862e68d5628fa1f2c84731d4/apps/projects/app/store/helpers/issues.js#L26

It looks like you are using chrome, could you give me the cURL request ?

I’m getting the same issue, this is my add request:

curl -H 'Host: ipfs.infura.io:5001' -H 'accept: */*' -H 'content-type: multipart/form-data; boundary=jrAYs1aeI3vG5z99gHcM5mnf27cdvyQm' -H 'user-agent: Swift IPFS Client' -H 'accept-language: en-us' --data-binary '--jrAYs1aeI3vG5z99gHcM5mnf27cdvyQm

content-disposition: file; name="file";

content-type: application/octet-stream

content-transfer-encoding: binary

cmon just pin me already

--jrAYs1aeI3vG5z99gHcM5mnf27cdvyQm--

' --compressed 'https://ipfs.infura.io:5001/api/v0/add?stream-channels=true'

and this is my pin request:

curl -H 'Host: ipfs.infura.io:5001' -H 'user-agent: my-proj/21 CFNetwork/897.15 Darwin/17.5.0' -H 'accept: */*' -H 'accept-language: en-us' --compressed 'https://ipfs.infura.io:5001/api/v0/pin/add?stream-channels=true&arg=QmPTExpvLpQstJDJb8icrqQZ5LHEqGe2G98gpm2qymgMeH'

it happens like 20% of the time when pinning.

I am also seeing issues with one off our service - “Gateway Timeout” on some of the pinned images.

Same here, and it is doing it intermittently. I think it has something to do with Infura itself rather than the code.
Thank you.

Thanks everyone, we are looking into this, we will update once we have more information.

Hello,

I’m sharing the issue here as this thread seems more relevant, we are encountering the same issue when retrieving pinned data. That is the IPFS.add function correctly returned the hash without any exception, but when trying to retrieve the file a minute after and (even now, hours after), the gateway times out. Here are two hashes that aren’t working :
Qmf7yvoeCSfLcMZtfT9UaPkz383VJvXkkL8rYpz4oRRufk
QmYTWr3Qh1KQf6XQ2s7uM1YcbvJHVcukTS1MCkb7aYzQgU

Is this data lost ?
Many thanks,

Would you provide us with your code that is generating these requests and the full error response?

Hello Mike and thanks for your reply.

This is the upload code, which executed successfully with photoNearHash and photoFarHash being filled in with the values of my previous post :

  var photoNearFileContent = await Buffer.from(await LoadFileAsync(photoNearFile));
  var photoFarFileContent = await Buffer.from(await LoadFileAsync(photoFarFile));

  var photoNearHash = null;
  var photoFarHash = null;

  try {
    var res = await ipfs.add(photoNearFileContent);
    if(!res) throw new Error("uploading photoNearFileContent failed");

    photoNearHash = res[0].hash;
    dispatch(actions.receiveIpfsHash({photoNearHash: photoNearHash}));

    res = await ipfs.add(photoFarFileContent);
    if(!res) throw new Error("uploading photoFarFileContent failed")

    photoFarHash = res[0].hash;
    return dispatch(actions.receiveIpfsHash({photoFarHash: photoFarHash}));
  } catch(err) {
    dispatch(actions.fail());
    alert(err);
    return;
  }

As for the code generating the error, it is simply a get request :

  const photoNearUrl = ifpfsGatewayAddress + "/" + photoNearHash;
  const photoFarUrl = ifpfsGatewayAddress + "/" + photoFarHash;
  //const photoNearLocalPath = "./public/pdfAssets/ipfsAssets/" + photoNearHash + ".jpeg";
  //const photoFarLocalPath = "./public/pdfAssets/ipfsAssets/" + photoFarHash + ".jpeg";
  var photoNearBuffer = null;
  var photoFarBuffer = null;
  var tries = 1;
  while(!photoNearBuffer || !photoFarBuffer) {
    try {
      if(!photoNearBuffer) photoNearBuffer = await request({url: photoNearUrl, encoding: null});
      if(!photoFarBuffer) photoFarBuffer = await request({url: photoFarUrl, encoding: null});
    } catch(e) {
      if(tries > 6) throw "error while downloading files from ipfs: " + e.toString();

      await delay(tries * 30000);
      tries++;
    }
  }

The exact error being

error while downloading files from ipfs: StatusCodeError: 504 - {“type”:“Buffer”,“data”:[71,97,116,101,119,97,121,32,84,105,109,101,111,117,116,10]}

I got the same error in my browser, which now seems to have changed to a 502 bad gateway (after 10 minutes of loading or so) :
https://ipfs.infura.io/ipfs/Qmf7yvoeCSfLcMZtfT9UaPkz383VJvXkkL8rYpz4oRRufk
https://ipfs.infura.io/ipfs/QmYTWr3Qh1KQf6XQ2s7uM1YcbvJHVcukTS1MCkb7aYzQgU

As you can notice, I put a loop with a delay in my code when getting the files. That’s because from times to times, the pinned files aren’t available before 5 minutes or so after the IPFS.add, but this time it’s been about 8 hours already.

Any help would be much appreciated, especially regarding the state of those files. We completely relied on your node for storing files so I’d really need to know whether or not those two uploads are definitely lost (it’s user generated content :sweat_smile: )

( to answer your question on the other thread, that issue was lastly experienced today, about 8 hours ago )

Thanks for the added info! We pushed a fix that should resolve the 504 errors you’re seeing, can you test it now?

Hello Mike,
A new upload worked fine, but the two hashes I gave you are still timing out :confused:

Follow up : I ended up asking my client to send its file by e-mail for re-upload.

While Infura is awesome for Ethereum, I wouldn’t say the IPFS service is ready for production yet. There is currently no warranty that a successful call to IPFS.add will actually upload & pin your file, as you might find out later when retrieving your file with the generated hash that it was a false positive. I’ll use a second node provider as a backup on our D-App for now, even though I’d have preferred to stick with Infura even if I had to pay for it. Thanks for your help @mike

I am getting the same issue

Hi vishesh,

Are you still experiencing any issues with our IPFS endpoint?

Now its working fine. Thanks