504 Gateway Timeout -- Memory Error

I’m getting “504 Gateway Timeout” error on the production site, and I know I’m pointing to the server because if I access this route I get the expected result.

I ran in this while looking for answers:

I ran the commands described above and got the following results:

  1. free -m

total used free shared buff/cache available Mem: 985 190 192 0 602 642 Swap: 0 0 0

  1. mpstat

Linux 4.15.0-51-generic (ubuntu-s-1vcpu-1gb-sfo2-01) 06/11/19 x86_64 (1 CPU)

14:07:05 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 14:07:05 all 0.31 0.01 0.07 0.28 0.00 0.00 0.01 0.00 0.00 99.33

The first one it’s confusing since it shows that we have as free memory only 190 but then it shows 642 as available? The post said this error could be related to not having enough memory for the server, but how can I be sure about this?

I have 2 html websites and this angular firebase application (which we’re trying to configure with running on a 1 GB Memory / 25 GB Disk / SFO2 - Ubuntu 16.04.5 x64 which has been upgraded to 18.04.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I solved the problem – it wasn’t actually a memory issue at all. it was that the node js server wasn’t secure. I followed this two part tutorial and was able to solve the problem.

I followed this two-part tutorial:

It was also important to specify the transport in the call as discussed here:


I had a similar issue. By default the droplets come without a SWAP file so if you run out of RAM there’s no buffer and some processes would get killed.

You could try adding 1GB SWAP file to at least have some buffer. You could follow these steps here:

Hope that this helps!

I went ahead and added 1GB Swap, and I’m still facing the same issue.

I’ve also upgraded to a 2GB droplet to keep testing the memory issue:

free -m Mem: 1993 118 1532 0 343 1731 Swap: 1023 0 1023