DEV Community

Etinosa Obaseki
Etinosa Obaseki

Posted on

2 1

Running Scheduled Firebase Functions Locally

TL;DR Use $ firebase functions:shell and then type in the name of your function (tab autocomplete is available) along with any arguments you need to pass and press enter. You receive the output to the console.

While developing Firebase Functions, we need to run them locally to ensure that everything works as we might expect before we deploy the function to the cloud.

For HTTP Functions, it's a straightforward process to run $ firebase serve in the terminal and then visit the browser.

Firebase Scheduled Functions can have one of several triggers (similar to HTTP Functions that are triggered by a HTTP Request).

The problem is that we often cannot set up the trigger for Scheduled Functions the way we can for HTTP Functions.

For example, with the PubSub triggers it would be impractical to try to set up a pubslisher-subscribe system on our local environments and test that our functions run every minute as prescribed.

We'll instead leave that to the Firebase team. Instead, we want to test that our functions executes as it should.

Use $ firebase functions:shell and then type in the name of your function (tab autocomplete is available) along with any arguments you need to pass and press enter. You receive the output to the console.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (1)

Collapse
 
areindl profile image
Anton Reindl

Do you have an example? Seems not to work.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay