Operating System
MacOS
Browser Version
Chrome 117.0.5938.149
Firebase SDK Version
10.5.0
Firebase SDK Product:
Firestore
Describe your project's tooling
Next.js app
Describe the problem
In our project we actively use withConverter. Some of converters sometimes returns undefined when they see logically null value. It worked fine in version 8.10.1
After update to the 10.5.0 version with compat enabled we are getting exceptions on reading data()
from the elements of the collection.
It does not happen when document is accessed directly by it's path.
Error comes from this code:
https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore-compat/src/api/database.ts#L975
Steps and code to reproduce issue
let converter = {
toFirestore: (x) => x,
fromFirestore: (snapshot, options) => {
const data = snapshot.data(options);
// if data is empty return undefined
return undefined;
}
}
let collection = firestore.collection("someExistingCollection").withConverter(converter)
collection.get().then(x => x.docs.forEach(xx => console.log(xx.data())))