Error: 403 Gateway Timeout when uploading file to IPFS

Hello,

As marked in the title, I got an 403 Gateway timeout when I try to upload a file to IPFS. According to the documentation the size limit is 50 Mb https://docs.moralis.io/moralis-dapp/web3-api/ipfs-storage-new#uploadfolder-new

I try to upload a file of 33Mb, it shouldnā€™t be a problem. File size much small (4/5Mb) are uploaded without any problems.

Is there anything I can do on my side?

did you try multiple times?

Yes. With different files smaller than 50Mb. All of them fail to upload except files that are smaller than 5/10Mb.

I would expect it to work with more than 10MB

you could try to use the normal IPFS upload functionality to upload bigger files, as in to not upload them in the same folder

I tried with the normal IPFS upload, I no longer have a 403 error, however the url sends me to a file of only 95 bytes. I have the exact same problem as this person : Uploading GLTF or GLB Files

In my case I am trying to upload .zip files.

how did you upload it to IPFS? that should happen only when you try to upload in the database and not on IPFS

public async UniTask<string> UploadFile(string filePath)
		{
			Debug.Log("[FileManager] Start to upload file: " + filePath);
			string filename = Path.GetFileName(filePath);
			string filteredName = Regex.Replace(filename, @"\s", "");

			byte[] data = await File.ReadAllBytesAsync(filePath);

			MoralisFile moralisFile = new MoralisFile(filteredName, data, GetMimeMap(Path.GetExtension(filePath)));
			await moralisFile.SaveAsync(Moralis.GetClient().ServiceHub);
			if (moralisFile.url == null)
			{
				Debug.LogError("[FileManager] Failed to save file to IPFS");
				return null;
			}

			Debug.Log("[FileManager] File saved successfully to IPFS:" + moralisFile.url.AbsoluteUri);
			return moralisFile.url.AbsoluteUri;
		}

I am using the Unity SDK

you could try to use a cloud function:

Moralis.Cloud.define("uploadToIPFS", async (request) => {
  
  const result = await Moralis.Cloud.toIpfs({
  sourceType: 'object',
  source: request.params
});
return result;
  
});

something like this, but donā€™t use this syntax as it will work only with json objects

probably this line saves it in the database and not on IPFS

I was able to implement a working version with Cloud functions but ā€¦ got the same issue as here : IPFS - Maximum call stack size exceeded

However in this post it is recommended to use the folder upload feature while waiting for a fix, we come back to the initial problem where I end up with a 403 Gateway error. To summarize, no solution to upload ā€œlargeā€ files (>10mb) :frowning:

I will end up uploading to a temporary server and retrieving the url and uploading via a cloud function with a sourceType ā€œurlā€ ā€¦

I will end up uploading to a temporary server and retrieving the url and uploading via a cloud function with a sourceType ā€œurlā€ ā€¦

[Discourse post]

I remember now about that issue with maximum call stack