Is it possible to run Firebase cloud functions locally during development? It takes a long time to deploy to firebase every time a change have been made.
Thanks
The Firebase Local Emulator Suite is a set of advanced tools for developers looking to build and test apps locally using Cloud Firestore, Realtime Database, Cloud Storage, Authentication, Cloud Functions, Pub/Sub, Firebase Hosting and Firebase Extensions.
There is currently no way to deploy a single function with the Firebase CLI. Running `firebase deploy` will deploy all functions.
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.
I think you can use their cloud function emulator
More details here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With