Skip to main content

Understanding Firebase Cloud Functions Logs

Danny avatar
Written by Danny
Updated over 3 weeks ago

When troubleshooting Firebase Cloud Functions within Firebase, it can be challenging to understand what to look for and where to find it. In this short article, I’ll share some pointers on where to check when a Cloud Function fails to deploy, doesn’t work as expected, or when you want to review the general operation and logging of a Cloud Function.

Google Cloud Observability

Firebase provides tools like Google Cloud Observability, which offers logging and monitoring features that help you understand what is happening in your Cloud Run resources.

Google Cloud Observability includes services that help you understand the behaviour, health, and performance of your applications. Having visibility into how applications behave and how components are connected helps you anticipate, identify, and respond to unexpected changes more quickly and effectively.

To make this simpler, we’ll focus on Firebase Cloud Function logging.


Open your Firebase project and navigate to Functions.

From within the Firebase Functions page, you will see a “View logs” link that directs you to the logs for all Cloud Functions in the project.

Once on the page, you will be able to see all the logs from all Cloud Functions linked to your Firebase project. You can also filter the logs by specific Cloud Functions, depending on which function you want to observe.


Another way to view logs from within Firebase is by opening the Google Cloud Console and navigating to the Cloud Functions section.

You can go directly to:

https://console.cloud.google.com/functions/list


This page lists all the Cloud Functions in your project. Select one of the functions, then navigate to the Logs tab to view its logs.

Firebase has six levels of log severity. These are:

Level

Severity

Usage

debug

🔧 Low

Detailed developer debugging

info

ℹ️ Normal

High-level flow messages

log

📄 Normal

Generic logs, similar to console.log

warn

⚠️ Medium

Something unexpected but not fatal

error

❌ High

Failures, exceptions

write

📝 Special

Rarely needed manual log writes

Below is a quick example of a Cloud Function log:


The “i” represents an info message log. This high-level message flow can indicate the processes that run when a Cloud Function is executed.


The warning log shows an unexpected result that was received by the service, but generally it doesn’t break the Cloud Function. In most cases, you will see a warning before an actual error occurs.

In this example, the Cloud Function expected a POST request but only received a GET request, which triggered the warning.


Below we have an error log. The first line of the error message is usually the full response from the Cloud Function. This is the log or error that is thrown directly by the Cloud Function.


Digging deeper, the error log usually contains more details about what might have happened. In some cases, it will tell you exactly what the Cloud Function expected and what was missing.

In this example, the Cloud Function expected a payload that was never received, resulting in an exception being thrown.


This is an overview of how to look into logs. You can find more details on troubleshooting logs in the official documentation.

Did this answer your question?