这是indexloc提供的服务,不要输入任何密码
Skip to content

when fromFirestore returns undefined it leads to: FIRESTORE (10.5.0) INTERNAL ASSERTION FAILED: Unexpected state  #7719

@vdanchenkov

Description

@vdanchenkov

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())))

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions