New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Questions re: firebase integration #238
Comments
Hey! I'm not the maintainer, just someone trying to solve similar problems. I agree these would be awesome to have, but for now I've found some nice workarounds you could try:
|
Thanks for the ideals @mtwichel, I don't suppose you have an example of your nodejs function? I'm guessing we need to wait for Dart to be added as a Runtime option in GCP Cloud Functions for this to be properly resolved. At that point we won't need to use Cloud Run either. Thanks |
Also just spotted this discussion topic which is talking about EventArc, this looks like a great solution for connecting firestore & storage to your functions_framework project. |
Something like this? const functions = require('firebase-functions');
const {PubSub} = require('@google-cloud/pubsub');
const pubSubClient = new PubSub();
exports.myFunction = functions.firestore
.document('my-collection/{docId}')
.onWrite((change, context) => {
const dataBuffer = Buffer.from(change);
const messageId = await pubSubClient.topic(topicName).publish(dataBuffer);
});
Unfortunately, I don’t think that use case is supported yet because EventArc doesn’t have events that you can hook into from changes to documents in Firestore or changes in storage :/ It does have a Cloud Firestore section but it only has admin events in the logs (like deploying indexes). In fact, it looks like the only thing that isn’t just reacting to log evens is pubsub, so using the above function you would have to set up the EventArc trigger to listen to the same pubsub topic you’re publishing to. |
One year has already passed. Do you have any support plans for firebase? I would like to hear from the manager. |
Hey @Patrick386 – we're super excited to get functions going, but it's a lot of work across a few teams. We're super excited to have an offering is this space, but we won't having anything in the near future. |
Thanks for letting me know. We are waiting for good news. |
Hey @Patrick386, If you're willing to have a slightly more complex setup you can do what you need right now using this package & cloud-run (using Google Cloud Platform). You can even validate the Firebase authentication JWT tokens to make sure the user is logged in and grab their claims too. As a bonus you then have the benefit of being able to stick all your functions/cloud-run instances behind a global load balancer and do fancy things like caching and security. |
Hey @mtwichel did you have any luck with this? I noticed yesterday that there were Event Arc triggers now although I've been unable to get them working. I've been to Audit config and I've enabled Firestore write audit logs, but for some reason my Cloud run instance doesn't get invoked. |
Hi @jimmyff, did you found a solution on this topic? I'm facing the same issue.
|
Hey @diezep, I use One of the magic black boxes you get with Firebase functions is the authentication, however the cloud run approach you have to do that yourself: I send the Firebase Auth's JWT to my Cloud Run's endpoint which is verifies to be valid using I communicate with all the firebase services via Re: Triggers / EventArc: I never really got the EventArc stuff working correctly. Last time I looked at it (months ago) I did manage to get some general EventArc triggers invoking my CloudRun endpoints but I was unclear how to specify specific collections, I think there was a filter field but I had no idea what data/format it expected. I'm sure with some more fiddling I would have figured it out as it did seem to be working. The problem I had was the documentation hadn't caught up with the product development and I seemed to be the only person outside of Google trying to use this (based on lack of questions or discussion online / stack overflow). My solution was to work around the lack of firestore triggers. I use Google cloud Pub Sub which goes someway to fulfilling my requirements. I'll close this issue now as integration with event arc and firebase are out of the scope of this project. |
Thank you for respond @jimmyff, I'm trying to catch the trigger with Eventarc (still trying) but i will consider use pubsub instead. |
Hi,
This looks great, I'm currently using
firebase_functions_interop
on 3 production projects but as it seems that project has become unmaintained I need an alternative.I don't believe firebase functions allows for custom containers yet so I'm unclear how I could use this project in these situations:
Thanks
The text was updated successfully, but these errors were encountered: