Well, it's known for most users the error 504 is due to a weak internet connection. You can fix this issue by turning off and on the Airplane mode to re-connect your device to the internet. Or just switch to a stable and strong WiFi connection which will solve the problem in seconds.
What is 504 error downloading?
The HyperText Transfer Protocol (HTTP) 504 Gateway Timeout server error response code indicates that the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the request.
Why am I getting 504 gateway timeout?
The 504 (Gateway Timeout) status code indicates that the server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request. The error may be a temporary occurrence due to too much traffic toward the server or site.
What is HTTP 504 status code?
An HTTP 504 status code (Gateway Timeout) indicates that when CloudFront forwarded a request to the origin (because the requested object wasn't in the edge cache), one of the following happened: The origin returned an HTTP 504 status code to CloudFront. The origin didn't respond before the request expired.