Can't use FieldValues inside an Array: AsyncQueue Failed to persist write: TypeError: Cannot read property 'M' of undefined (original) (raw)

[REQUIRED] Describe your environment

[REQUIRED] Describe the problem

When using a Firestore FieldValue in an array, for example a serverTimestamp or delete, Firestore crashes with the error:

firestore-memory:

AsyncQueue Failed to persist write: TypeError: Cannot read property 'M' of undefined

or

firstore:

AsyncQueue Failed to persist write: TypeError: Cannot read property 'B' of undefined

Steps to reproduce:

firebase.firestore().collection("test").doc("a").set({ thing: [firebase.firestore.FieldValue.serverTimestamp()] })

PTAL at the codesandbox. Click "Bad Data" and it will crash Firestore.

Relevant Code:

https://codesandbox.io/s/simple-firestore-javascript-example-gmygz

As far as I know, this used to work