Unable to deploy app to moralis server - Request body larger than maxBodyLength

Hello,

I am trying to deploy my react app to moralis, however I get an error: Request body larger than maxBodyLength
Is there any way to control this parameter?

This is what I get on my console:

 moralis-admin-cli deploy -p build
Following servers were found:
 ....
What server do you want to connect to?: 1
En error occured when trying to deploy
Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit
    at RedirectableRequest.write (/usr/local/lib/node_modules/moralis-admin-cli/node_modules/follow-redirects/index.js:102:24)
    at FormData.ondata (internal/streams/legacy.js:19:31)
    at FormData.emit (events.js:315:20)
    at FormData.CombinedStream.write (/usr/local/lib/node_modules/moralis-admin-cli/node_modules/combined-stream/lib/combined_stream.js:138:8)
    at DelayedStream.ondata (internal/streams/legacy.js:19:31)
    at DelayedStream.emit (events.js:315:20)
    at DelayedStream._handleEmit (/usr/local/lib/node_modules/moralis-admin-cli/node_modules/delayed-stream/lib/delayed_stream.js:82:15)
    at ReadStream.source.emit (/usr/local/lib/node_modules/moralis-admin-cli/node_modules/delayed-stream/lib/delayed_stream.js:29:19)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9) {
  config: { ...

Thanks,
Gerald

1 Like

Hey @nutrina, hope you are ok.

What is the total size of your project folder? for now, maximum size should be less than 64mb.

We can upgrade the size, but 64mb should be enoughā€¦let us know.

Carlos Z

Hello,

Thanks for the response.
That is strange.
The size of my folder is only 43mb:

āœ— du -h -d 0 build 
 43M    build

For now this is not an urgent topic for me, I have deployed on another server.

Thanks,
Gerald

1 Like

Hi @nutrina,
I have the same problem, can you please give me advice on what other server to use for free? It is quite urgent for me. Thanks.

@thecil,
I have the same problem. My folder is 83,4 Mb. When I uninstall moralis-admin-cli node_modules and run it from different folder (where I have moralis-admin-cli) it still does not work even though my folder is 60Mb. Can you please help? It is urgent. Thanks.

Hi,
You can use GitHub pages: https://pages.github.com/ as a hosting alternative.

1 Like

Hi @cryptokid,

thanks, however I canā€™t upload my node_modules there, which is a huge file, and without that the website wonā€™t run. Is it possible not having node_modules on my repository but to fetch it from other places so website can run? I need mainly web3, ethereum-block-by-date, node-fetch, jquery.

Hi,
Not sure what you want to do, you should upload only what is needed for your website to run and not your entire development folder.

1 Like

Oh right. Sorry for this stupid question. I am new to this, I thought that you need node_modules on server too. Itā€™s working now, maybe because I used browserify. Thanks.

1 Like

@cryptokid Can I have one more question out of topic please? Is it safe to share my Etherscan API key in code? I want it for the user to be as convenient as possible, so I would rather implement my code with my API key.

Otherwise user would need to create account on Etherscan, generate his own API key and then enter it in application. Which is not user-friendly.

1 Like

I guess that you can use it this way until you find a better way.

What is the size of the folder that you want to upload?
In case that you want to upload the entire development folder, you donā€™t need to do that, you only have to upload what is needed for the website to work.

Iā€™m currently testing a workaround where I upload the files to the database, then pull from there as needed.

This workaround was successful.

1 Like

Iā€™ve got a 33M site that hits the size limit error. What is the size limit today?

1 Like

there is a buffer upload limit, that also is influenced by converting the data to base64.
but in theory 20MB could work to upload.

how is that you have a 33MB site?

Weā€™ve switched to Netlify for hosting. Iā€™ve no idea how our simple wallet site compiles to something that big. Itā€™s just ReactJS, Material.io, Moralis.io, Transak, and a few .svg images. See for yourself.

Mine is 30mb and getting the same errorā€¦ :unamused:

You can deploy your app to another provider like Netlify or Vercel.

very silly question butā€¦ how? Iā€™ve tried to upload the build files to a server I have with ovh and it doesnā€™t work. do we need a terminal command to deploy it to others servers ?
whatā€™s the size limit for moralis? iā€™ve read 64, 50, 25mbā€¦ can you please decide on one?

It depends on what you upload, the size limit is for the base64 encoded form of the data.

You can use any other provider to upload a website.
You should upload only the results of build from the build folder usually.

my application is made of many files all of which combined are around 30mb. Iā€™m using the terminal command line ā€œmoralis admin deployā€ from within the build folder that contains all the files. is 30mb in total too much?