'Firebase 502 Bad Gateway on Storage dashboard

Recently our downloads through Firebase Storage started failing with a 502 Bad Gateway error.

We first noticed this in our apps, but later found out that the same error occurs when trying to download any file through the Firebase Storage dashboard. When trying to download the same file directly through the Google Cloud Console it works fine, no errors. This happened with all our Firebase projects.

I've already checked our access rules, service account permissions and it all seems to be right.

Is there any way for me to find out why is this error happening?



Solution 1:[1]

I would suggest to enable and check access logs on your Firebase Storage. To do that, you would need to use Audit logs.

  1. Head on to your Cloud Console then you would need to access to IAM & Admin > Audit Logs.
  2. In the Audit Logs page, find or filter Cloud Storage for Firebase API and Google Cloud Storage.
  3. Change the configuration in order to start logging actions (I would suggest to enable the three options Admin Read, Data Read, Data Write). You can follow this link if you need more information about how to activate them.

After configuring the audit logs, try to access or download files from the Firebase Storage and Google Cloud Storage. You may view the data read logs on Logging > Logs Explorer, in here you need to select your service, find Resource Type and select the GCS Bucket. You can now see all the Cloud Storage logs that you configured on the Audit Logs.

If you still can't get to know why the error happens after checking the logs, I would suggest that you contact Firebase Support to be able to assist you further on your concern.

Solution 2:[2]

Yes, it seems related with custom metadata on storage files. I managed to solve it by replacing blanks with underscore in metadata parameters name, e.g. "user name" caused 502 error but "user_name" works fine. I guess this happend after some recent firebase library update.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marc Anthony B
Solution 2 Artem Litvin