Run Firebase cloud functions locally?

I think you can use their cloud function emulator

More details here


firebaser here

Firebase now provides an emulator suite that allows you to run Cloud Functions and many other Firebase products locally, for local development. I highly recommend using this for all local development, before deploying to production (or even staging).

Previous answer

Update (September 2017): since version 3.11 of the Firebase tools/CLI there is a Cloud Functions shell, which you can use to test your functions locally without deploying them. I recommend reading the blog post Testing Functions Locally with the Cloud Functions Shell and the documentation on how to Run Functions Locally.

Update: since version 3.8 of the Firebase tools/CLI, it has the ability to emulate HTTP functions when you run firebase serve. Other trigger types are still not supported though.

Previous answer

We're working on it. In the meantime, I'll quote fellow Firebaser Doug from the firebase-talk mailing list:

Unfortunately, this does not exist today. A local environment for building and testing Cloud Functions is a high priority for the engineering team.

In the meantime, you could abstract away the core functionality of your function and invoke it directly with the node command line, passing in all necessary data that it needs to operate. For example, with an HTTPS function, figure out what you need from the request object, make that the input to another function, then invoke that with dummy data that you create. The response could be handled similarly.