"413 Request Entity Too Large" Shopify blocking requests over 1MB?

Solved
SaphiraDev
Tourist
12 2 1

I'm uploading files to my server using axios, and it works perfectly on requests under 1MB.

However, when I upload over 1MB to my server in a single request my request is blocked and a 413 error is thrown. It shows it's from NGINX in the response:

response (1).png

The request doesn't reach my server and is blocked client side. Any help would be appreciated.

Professional Front-End Developer | Available for work | Contact at: saphiradev@gmail.com
0 Likes
Michal_Morek
Shopify Partner
821 73 139

This is an accepted solution.

Hi @SaphiraDev 

Hope you're having a great day!

You said you were uploading files to your server. So this error has nothing to do with Shopify but rather your server.

Take a look at the Shopify file uploading requirements:

Uploading-and-managing-files-·-Shopify-Help-Center.png

The 413 status code indicates that the request was larger than the server can handle, either due to physical constraints or to settings. Usually, this occurs when a file is sent using the POST method from a form, and the file is larger than the maximum size allowed in the server settings.

You should increase the value of parameters memory_limit, post_max_size, or upload_max_filesize in your server configuration.

If you found this comment useful, hit the 'Like' and 'Accepted solution' buttons.

Founder of Shopify agency - Accomplishify.com
If you would like to hire us as Shopify experts, please reach out via:
  • Email michal.morek@accomplishify.com
  • WhatsApp +48 507 613 425
SaphiraDev
Tourist
12 2 1

This is an accepted solution.

After countless days of debugging I finally figured it out. I even started to refactor my entire code just to figure it where it was coming from.

Just like after figuring out most bugs, I feel like it was under my nose the entire time.

Shopify serve wasn't working properly for me a few days ago so I switched to a local tunnel package: http://localtunnel.github.io/www/. I only did some tests a day later with uploads so I didn't realize it was coming from that package.

Localtunnel was blocking all the requests over 1 MB, and once I switched back to ngrok everything worked perfectly. I was correct with the assumption the error was not coming from my application, however I incorrectly guessed it was Shopify when it was actually the local tunnel package.

Thank you for the help @Michal_Morek, I appreciate it

Professional Front-End Developer | Available for work | Contact at: saphiradev@gmail.com
0 Likes
Michal_Morek
Shopify Partner
821 73 139

Hi @SaphiraDev 

Hope you're having a great day!

You're welcome. I'm happy you've found a solution.

Have a good luck.

Founder of Shopify agency - Accomplishify.com
If you would like to hire us as Shopify experts, please reach out via:
  • Email michal.morek@accomplishify.com
  • WhatsApp +48 507 613 425
0 Likes