Firebase cloud function deployment webhook - firebase

I would like to get notified (webhook or something) when someone deploy a Firebase cloud function. Also I would like to know who is deploying that function or may be history of deployed cloud function.
Firebase provides history for web hosting but I'm not able to find anything similar for cloud function in Firebase console as well as GCP console.
Thanks in advance.

There is currently no webhook or history for function deployments. Please feel free to file a feature request.

Related

How to Firebase cloud function deploy privately

When i use firebase deploy --only functions to deploy cloud functions for firebase, i discover, that this functions are deployed with the authentication flag allUsers.
How can i deploy firebase cloud function with private by default as mentioned here ?
There is no way to set this access control level of Cloud Functions through the Firebase CLI. It currently indeed always sets the access to allow all users. It sounds like a reasonable request to allow control of this though, so I'd file a feature request and possibly a PR on the repo.
For now: if you want to set this access level, you will have to do so in the Cloud console as explained in the Google Cloud documentation on controlling access on a function.

Unable to trigger firestore changes locally

I just started doing firebase and I need to do something when a new document is created but in functions and I setup cli and started locally but the function is not triggered.
while doing firebase init I chose firestore,functions,storage
after that did firebase login and firebase serve --only functions
and the server is up but whenever I add new document the function is not getting triggered?
You should be able to do that with firebase emulators:start. This starts emulators for Cloud Functions, Cloud Firestore, Realtime Database and Firebase Hosting. If that doesn't work, please share your code and I can have a look.
The docs may be useful too: https://firebase.google.com/docs/functions/local-emulator#run_the_emulator_suite

Firebase - Cloud Functions : Always running functions

I am new on firebase cloud functions. I would like to ask a question about always running or self-triggering functions. How can we handle these things? How can we implement always running functions or self-triggering?
Google Cloud Functions are snippets of code that run in response to events that happen somewhere else. Some example events:
a HTTPS URL is accessed, either from application code, or in some other way
a User account is created on Firebase Authentication
a node is written in the Firebase Realtime Database
a message is sent to a Cloud PubSub topic
There is no concept on a forever-running function on Cloud Functions (nor on other, similar Functions-as-a-Service offerings), although it's definitely possible to create a function that gets triggered every minute or so (like a cron job).

Mix Cloud Functions w/ Firebase

I have some pub / sub setup on Google Cloud and I have some Cloud Functions running on Firebase.
I'd like to set a trigger on Firebase, so when a user account is created, I publish a message to a topic on Google Cloud.
Is this possible? Am I missing something obvious?
I can trigger a cloud function on account creation and I'm happy at this point showing a console log.
I was considering in my Firebase trigger add something like #google-cloud/pubsub so I can literally setup the message in the body of my firebase trigger, but that feels a little wrong.
Quite clunky and not the way it should be done?
In short, I guess what I'm trying to do is firebase publish to topic on trigger?
I don't think there's anything wrong with what you're suggesting as a solution. You can use an authentication trigger to find out when a new user account is created, then use the node Cloud Pubsub SDK to turn around and publish a message to your topic. There's really no more straightforward way to accomplish this that I can think of.
It's pretty common to mix Cloud APIs into your Cloud Functions, regardless if they're based on Cloud or Firebase events.

Does Firebase has direct cloud function trigger?

In times when Parse.com was on they had a function that called a cloud function directly and returned whatever I wanted. So I could have all the server logic on the server, not in client code. Doe's Firebase has it as well? I can't find it - all I found are HTTP triggers, but it implies that it's not available through Javascript SDK. Am I missing something or do I have to use REST interface for that?
To run server-side code that is triggered by events in Firebase, you'd use Cloud Functions for Firebase. Currently these can trigger code through the Firebase Database updates, Authentication, Analytics, Cloud Storage and HTTP. The documentation I linked has all the details.
As Frank van Puffelen has explained you could use Functions, I'll like to add a couple of things.
You could also use the Firebase Database Admin SDK for the Database, this requires you have a server
Firebase Functions is a sort of big brother, constantly listening for whatever you want. Currently starting and deploying functions is fairly easy and fast, I love this how to video. Basically, you have to install the CLI and then using commands, create a project, write your js for Functions and for deploying those changes to Firebase Functions use the CLI again
Functions can listen more than what the Admin SDK can, the Admin SDK is for the Database while Functions is for, authentification, database, and cloud messaging. This means any user registration or deletion or any change in a node, can trigger further logic. This logic could include sending push notifications. There is a github repo where you can see a lot of examples, I made myself a small repo for the same purpose

Resources