The QueryDocumentSnapshot passed to onCreate() trigger failed to retrieve FakeFirestore instance within its ref value after query a document from the database.
Note that the first console.log in the trigger function for snapshot.ref print with FakeFirestore instance that provided by test suit.
Note that the second console.log in the trigger function print without FakeFirestore instance, instead it says firestore:undefined
Expected result
Firesore instance with provided FakeFirestore instance would remain untouched with snapshot object after retrieving a document from the database query as shown in the trigger function
Actual result
The snapshot object reference FakeFirestore object went undefined after making the database query
I've just found out that this happens when calling the admin.firestor() call on the functions class. Somehow, admin.firestor() call resets the already obtained snapshot inside the trigger function.
Description
The
QueryDocumentSnapshot
passed toonCreate()
trigger failed to retrieveFakeFirestore
instance within itsref
value after query a document from the database.Steps to reproduce
onCreate()
functions triggerMake a test class
snapshot.ref
print with FakeFirestore instance that provided by test suit.FakeFirestore
instance, instead it saysfirestore:undefined
Expected result
Firesore instance with provided FakeFirestore instance would remain untouched with snapshot object after retrieving a document from the database query as shown in the trigger function
Actual result
The
snapshot
object reference FakeFirestore object went undefined after making the database queryEnvironment