0

I have a nodejs app deployed on Digital Ocean and running on Ubuntu. I am using Nginx as my reverse proxy to redirect requests to the application's port.

I have been testing this app for quite sometime now and all the past weeks before today, I was able to flawlessly upload files big or small, but just recently the process just started to hang and then return a 504 Gateway timeout. My first instinct is that this has something to do with Nginx, so i did some researcha and most solutions suggested adding the following to a server block in nginx:

client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
client_max_body_size 100M;

Now i dont think i'll ever allow my users to upload anything above 5MB, but i set the max upload body_size to 100M. But still did not work.

I am at a loss here guys considering this was working just fine days ago and I really avoid messing with Nginx unless in situations like this.

Help me out :)

CliffTheCoder
  • 394
  • 1
  • 4
  • 24
  • 1
    More inclined to suspect your Node.js backend, tbh, and that's what the 504 is saying after all. What is keeping your Node processes running? When were they last restarted? Does the response return to normal (for a while) after restarting them? Either way, having a timeout of 3 minutes to upload < 5Mb is, well, bonkers (unless you're on a 33.6 dial up) – randomsock Aug 13 '20 at 18:45

1 Answers1

0

OK so after further research, I began to look into the possibility that it might be something wrong with my code. So i inspected the project piece by piece and realised that the directory to which I was supposed to uploading files to was not there. I remembered that before my last git commit, I .gitignored it so that i should not be pushing my local uploads along with the rest of the project, so the directory got deleted. Before I was to launch the app in Live Production, I git pulled it into my Digital Ocean ubuntu server, but this time without the uploads directory.

SO fixing this got my project working perfectly.

CliffTheCoder
  • 394
  • 1
  • 4
  • 24