firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Add support for deploying 2nd gen Firestore auth context triggers

Open blidd-google opened this issue 1 year ago • 0 comments

Auth context support has only been available for RTDB 1st gen functions — until now! The Firestore and Eventarc teams have recently added support for Firestore Cloud Events to include event actor information, adding four new event types. These changes enable us to offer the following four new 2nd gen Firestore trigger types in the Firebase Functions SDK, whose events will additionally contain the auth context along with the existing event data:

  • onDocumentWrittenWithAuthContext
  • onDocumentUpdatedWithAuthContext
  • onDocumentCreatedWithAuthContext
  • onDocumentDeletedWithAuthContext

See the functions SDK PR for more details: https://github.com/firebase/firebase-functions/pull/1519/

Users should take special care to avoid event loss when migrating from the original 2nd gen Firestore trigger to the auth-context trigger. The CLI will prompt the user to confirm unsafe migrations that may result in triggers dropping events during the event type update process. See the migration guide for more details about best practices. (TODO: link migration guide when available)

TODO: add link to migration guide in prompt warning when available

blidd-google avatar Feb 01 '24 19:02 blidd-google