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

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

Closed
thesandlord opened this issue Jun 5, 2020 · 1 comment · Fixed by #3183
Assignees

Comments

@thesandlord
Copy link

thesandlord commented Jun 5, 2020

[REQUIRED] Describe your environment

  • Operating System version: Windows 10
  • Browser version: Chrome 83.0.4103.61 (Official Build) (64-bit)
  • Firebase SDK version: 7.15.0
  • Firebase Product: Firestore

[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

@wilhuff
Copy link
Contributor

wilhuff commented Jun 7, 2020

Hi! Thanks for writing in.

This has never worked. In prior versions (e.g. 7.14.0) we threw an exception like this:

Failure: FirebaseError: [code=invalid-argument]: Function DocumentReference.set() called with invalid data. FieldValue.serverTimestamp() is not currently supported inside arrays

It looks like recent changes we've made to minification have broken this validation logic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants