IPFS video upload - 400MB - size?

Iā€™m getting this error when I try to upload a 500MB video. Same code works fine with a smaller one (35MB).

On IFPS session of Moralis.io itĀ“s said the limit is 1GB per file. Is that correct?

The error message is this:

moralis.js:28263 Uncaught (in promise) Error: Invalid file upload.
at handleError (moralis.js:25632)

1 Like

This is the log in the dashboard area:

  1. 2021-12-25T00:56:30.413Z - Parse error:

and the code inside the function:

Moralis.initialize(this.appID);

    Moralis.serverURL = this.server;

    const file_input = document.getElementById('file');

    const data = file_input.files[0];

    const file = new Moralis.File('video8.mp4', data);

    await file.saveIPFS();

    console.log(file.hash());

    console.log(file.ipfs());

The limit is of 1GB when uploading to IPFS.

I could try to test with a file of 400MB

You also have latest Moralis server version?

VM6:1 POST https://adhpw3nnfjad.usemoralis.com:2053/server/files/video8.mp4 400
(anonymous) @ VM6:1
dispatch @ moralis.js:25496
ajax @ moralis.js:25503
(anonymous) @ moralis.js:25610
Promise.then (async)
request @ moralis.js:25604
saveBase64 @ moralis.js:13394
(anonymous) @ moralis.js:13348
tryCatch @ moralis.js:41120
invoke @ moralis.js:41351
(anonymous) @ moralis.js:41176
asyncGeneratorStep @ moralis.js:28195
_next @ moralis.js:28217
Promise.then (async)
asyncGeneratorStep @ moralis.js:28205
_next @ moralis.js:28217
(anonymous) @ moralis.js:28224
Wrapper @ moralis.js:32713
(anonymous) @ moralis.js:28213
(anonymous) @ moralis.js:13362
value @ moralis.js:12975
value @ moralis.js:13027
enviar @ Login.vue?013f:48
conectar @ Login.vue?013f:31
await in conectar (async)
onClick._cache.._cache. @ Login.vue?013f:4
callWithErrorHandling @ runtime-core.esm-bundler.js?9e79:6737
callWithAsyncErrorHandling @ runtime-core.esm-bundler.js?9e79:6746
invoker @ runtime-dom.esm-bundler.js?8886:357
moralis.js:28263 Uncaught (in promise) Error: Invalid file upload.
at handleError (moralis.js:25632)

Iā€™ve just updated to version 0.0.314, but still getting this

it looks like 100MB doesnā€™t work for me either now, I get timeout

it works fine with 100MB, I didnā€™t test it right initially

1 Like

with 300MB it looks like it doesnā€™t work, can you test directly from cloud code?

https://docs.moralis.io/moralis-server/cloud-code/cloud-functions#ipfs

Okay, Iā€™m not able to test right now, but I will and let you know. Tks so much. Anyway, Iā€™ll have to make sure what the limit really is, to avoid my users to get stucked uploadingā€¦

Letā€™s hope itā€™s just a server Chrismasā€™ break and wait for Ivan Santa Claus giftsā€¦

I tried to call the cloud function and give an url param like this:

const result = await Moralis.Cloud.toIpfs({

    sourceType: "url",

    source:

      "https://drive.google.com/file/d/1B-XBWdgIkXXjZ6fxjLxGHFCT6c80kb_z/view?usp=sharing",

  });

But I got:
TypeError: Moralis.Cloud.toIpfs is not a function

Otherwise, if I call: const result = await Moralis.Cloud.run(ā€œtoIpfsā€,{ params})
I get:
Error: Invalid function: ā€œtoIpfsā€

Am I missing anything?

Besides, what I would like to do is to allow the user to upload a local video (mp4) from his/her machine direct to IPFS. As there is not a sourceType related to this kind of format, what should I do? Do I have to encode the video before? Or upload to any other host and from there send by url?

you could convert it to base64 and then send it, but youā€™ll have to test it how it works with big sizes, or upload it to any other host and from there send by url

I tested now with this code and it works fine for me:


Moralis.Cloud.define("try_ipfs", async (request) => {
const result = await Moralis.Cloud.toIpfs({
  sourceType: "url",
  source: "https://moralis.io/wp-content/uploads/2021/06/Moralis-Glass-Favicon.svg",
});
return result;
})

@matt_dev, I tested meanwhile with an upgraded server and it worked fine with a 300MB file

Great!

The coudFunction worked, but google and dropbox seem to block the url for download.
I will try to upload somewhere else and try from there.

Did you make it from an url?

I did it directly from Moralis SDK with 300MB

uploading from your local machine?

yes, from my local machine, but I used an upgraded server when it worked with 300MB

which version did you use?