520 Server Error trying to upload files to media library

System Information
  • Strapi Version: 3.6.5
  • Operating System: Linux OS
  • Database: MySQL
  • Node Version: 14.17.5
  • NPM Version: 6.14.14

Hey everybody,

When using strapi with pm2 like mentioned in the docs here I am unable to upload files in my media library using the admin panel under
Getting the Error 520 (see attached image below).

Somehow, when not running strapi with pm2, instead just use
NODE_ENV=production npm run start
I am able to upload files inside the admin panel.

So this obviously has something to do with running strapi using pm2 and is a crucial bug for running strapi in production.

I would highly appreciate any help you can offer to me! This topic is urgent to me.

I am looking forward to your answers!


Have you enabled uploads etc, also are you using any plugins or just local uploads ?
A 520 status code is normally a “catch” all server error.

Uploads is enabled inside the super admin role.
I am using local uploads to the public/uploads folder.

What is weird to me the most is the fact that uploads are working with npm run start, but not with pm2 start…

So if we narrow it down to a PM2 issue it could be something like this node.js - Multer upload files with PM2 - Stack Overflow

I’m not using PM2 with this so I can’t say for sure, but it looks to be over that it’s the wrong path it tries upload to.