Skip to content
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

Expose the internal snapshot_ method for public use #2227

Open
GriffinJohnston opened this issue Nov 15, 2024 · 6 comments
Open

Expose the internal snapshot_ method for public use #2227

GriffinJohnston opened this issue Nov 15, 2024 · 6 comments
Assignees
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@GriffinJohnston
Copy link

GriffinJohnston commented Nov 15, 2024

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.

@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/nodejs-firestore API. label Nov 15, 2024
@dconeybe
Copy link
Contributor

(drive-by comment: this appears to be a similar request to #2057)

@GriffinJohnston
Copy link
Author

(drive-by comment: this appears to be a similar request to #2057)

Yea, basically the same request. A sane, official way to convert document event protobufs into something useful.

@ehsannas
Copy link
Contributor

Thanks for the suggestion @GriffinJohnston . I'll bring it up with the team.

@ehsannas ehsannas self-assigned this Nov 19, 2024
@ehsannas ehsannas added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Nov 19, 2024
@GriffinJohnston
Copy link
Author

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 :)

@ehsannas
Copy link
Contributor

Hi @GriffinJohnston , could you elaborate on why you could not use the firebase-functions library in your workflow?

@GriffinJohnston
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/nodejs-firestore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants