This question already has answers here:
how to test Cloud Functions for Firebase locally on pc
(9 answers)
Closed 5 years ago.
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
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
Related
This question already has answers here:
Do Firebase Cloud Functions require Billing to be enabled by April 20, 2020 because of the Cloud Build API?
(2 answers)
Is Cloud Functions in Firebase Free or Not (Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan)
(8 answers)
Firebase how to deploy cloud functions for free
(1 answer)
Closed 2 years ago.
I was just making an app for Flutter learning cloud functions. When I check on a tutorial, cloud functions in firebase was free. But now I checked.
It's not, it's said to upgrade. Then I checked the pricing page,
So my question is if I upgrade, I lose spark plan, I need to pay for it? Is there any way to get spark plan just for testing?
if I upgrade, I lose spark plan, I need to pay for it?
You can create multiple projects, some on the free plan, and others paid. You can also remove the payment plan and go back to spark. As such, you will not "lose spark plan" if you choose to upgrade in order to use Functions in a project.
Is there any way to get spark plan just for testing?
After March 15, there will be no more option to use Functions for free on the Spark plan. Existing projects will be forced to upgrade, of functions will stop working
You should know that, even if you upgrade to a payment plan, there is a very generous free allowance that gives you use of functions without actually having to pay money. See the details on the pricing page. You get 2 million invocations per month. I think you'll find that very difficult to exhaust if you are just testing.
Also, you can always use the Firebase local emulators for free.
https://firebase.google.com/pricing
Yes you can downgrade from plans.
This question already has answers here:
Download Firebase Cloud Functions [duplicate]
(1 answer)
Get code from firebase console which I deployed earlier
(6 answers)
Closed 3 years ago.
A teammate deployed a Firebase cloud function to a shared account to which I have access. The source code isn't available to me yet, so I'm wondering if it's possible to read the source of a deployed cloud function (e.g. when logged into an account that has access to the Firebase console).
Does anyone know if this is possible? If so, any pointers on how one can read the source code of a deployed Firebase function would be hugely helpful!
If you have access to the Google Cloud console, you can access and download the source code there. You won't have the full benefit of having something like git access, but you can at least download a zip of the functions and see what's in production.
You can find the source of your functions that are < 512kb in the cloud console control panel here: https://console.cloud.google.com/functions/list?tab=source
I've been using Firebase for a long time and it's great, however I need more power for certain things.
At the moment, I have a function in Cloud Functions for Firebase to do some video processing and I need more power. I have heard Google's App Engine is better for this kind of solution and I've been experimenting with App Engine with my Google Cloud project.
I went to deploy my first Node.JS app function to App Engine and it seemed as if it was going to overwrite my existing functions I have. I have lots of functions, and code in Firebase for my app and my website to talk to one another, so I'd like to keep and leave my Firebase stuff alone.
I'm just wondering, how I'd use App Engine (and maybe some other higher end Google Cloud products) alongside Firebase without interfering or changing one another, but using the same project?
App Engine is an entirely different product than Cloud Functions. Anything you deploy to App Engine will not affect what you've already deployed to Cloud Functions, and the same applies in reverse. You can use both products in tandem with no conflicts.
Here, you can find more details related to the serverless environments options that you have. It would be helpful to read about each of them and choose whatever fits your needs better.
I'm relatively new to Firestore and I am currently trying to build a Flutter app on it. I have hit a roadblock where I realize that I must utilized Firestore Cloud Functions in order to perform server-side data manipulation.
Unfortunately, there are not a lot of great resources and videos describing the process to set this up (at least for someone super new to software development like me). However, I was able to find this video https://www.youtube.com/watch?v=DYfP-UIKxH0 that goes over how to set up a Firestore app using Typscript. As such, I have two questions:
Will setting up the environment to write cloud functions be the same here for Firestore as it will be for Firebase?
Do I want to write these functions in Javascript or Typescript?
Yes. When you use Cloud Firestore, you're essentially using Firebase, and the setup for Cloud Functions is the same between them. If you run into problems, post a questions with the minimal steps needed to reproduce that problem.
That's your call, as recommending one technology over another is off-topic here on Stack Overflow. That said, most developers coming from a background with strictly typed languages may prefer typescript.
I have a project for both Android and iOS that's using cloud functions for same app behavior and consistent data storing. For now we were debugging apps on single database, storage and authentication.
The problem is when I switch to release variant I want functions to operate on release database, storage and auth.
I've been searching for an answer to my problem and all I've found was this: How to access multiple Realtime Database instances in Cloud Functions for Firebase
but it doesn't help too much.
Is there a way to go about that without making another Firebase project for release variant?
Ok, so basically just a while after posting this question I've found official firebase guide that helped me resolve this issue.
Short answer: no, you have to create another project in Firebase as described in guide.