Expose the internal snapshot_ method for public use
What would you like to see in the library?
Currently Firestore document triggers in EventArc are extremely clunky to use. Decoding and then parsing protobuf-encoded payloads provides a poor DX compared to the ease of accessing document data in Firebase Functions. Firebase Functions is able to provide this smooth experience by making use of an internal Firestore method, snapshot_ found here: snapshot_
How it's used in FF: https://github.com/firebase/firebase-functions/blob/master/src/common/providers/firestore.ts
If you expose snapshot_ as a public method, it will make the experience of using EventArc Firestore Document triggers with something like Cloud Run way better. And since the method already exists, I can't imagine this would be such a big lift. Absolutely huge ROI on this effort for your users. Thanks!
Describe alternatives you've considered
Painfully decoding and parsing Protobuf-encoded data
Additional context/notes
I'm posting this here because this is where the internal snapshot_ method lives, but it would make sense to expose this through firebase-admin as well.
(drive-by comment: this appears to be a similar request to https://github.com/googleapis/nodejs-firestore/issues/2057)
(drive-by comment: this appears to be a similar request to https://github.com/googleapis/nodejs-firestore/issues/2057)
Yea, basically the same request. A sane, official way to convert document event protobufs into something useful.
Thanks for the suggestion @GriffinJohnston . I'll bring it up with the team.
Thanks for the suggestion @GriffinJohnston . I'll bring it up with the team.
Thanks! While we're here I should mention that the ideal would be a function that decodes the incoming protobuf and then also parses the resulting data into a DocumentSnapshot or even just a plain JS object. Something like the createSnapshotFromProtobuf function in the referenced Firebase Functions code. I'm happy to handle the protobuf decoding if it means getting this sooner though :)
Hi @GriffinJohnston , could you elaborate on why you could not use the firebase-functions library in your workflow?
@ehsannas I'm handling these events with a containerized application on Cloud Run. Maybe I'm missing something, but I haven't found anything in firebase-functions that would be relevant to my situation.
Hey @ehsannas, we're facing the same issue. Essentially we're trying to react to eventarc events using Cloud Run as as well, so we can have more control on the eventarc delivery. We're using a single Cloud Run service to handle Firestore events from various Firestore collections, even across projects.
We would not want to deploy the exact same Firebase Function a hundred times.
In addition to that, the "manual" workflow using eventarc gives us more control over retry settings and dead-letter queues.
Are there any updates on exposing such a function so we don't need to build such a parser ourselves?