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

failure when logging out: "1 errors occurred during unsubscription:1) Error: FIRESTORE (11.4.0) INTERNAL ASSERTION FAILED: Unexpected state" #8856

Open
LanderBeeuwsaert opened this issue Mar 20, 2025 · 5 comments

Comments

@LanderBeeuwsaert
Copy link

Operating System

Apple & Windows, Chrome & Edge

Environment (if applicable)

Chrome versions 111 => 133 - Edge version 134

Firebase SDK Version

11.3.1 and 11.4.0

Firebase SDK Product(s)

Analytics, Firestore

Project Tooling

We have an angular + angularFire + firebase web application.

Detailed Problem Description

Since upgrading from firebase-js-sdk v10 to v11 (now 11.4.0) we see that clients have the following error when logging out:
"1 errors occurred during unsubscription:1) Error: FIRESTORE (11.4.0) INTERNAL ASSERTION FAILED: Unexpected state"

Steps and code to reproduce issue

You can find the application here:
https://www.acro-companion.com/

@LanderBeeuwsaert LanderBeeuwsaert added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Mar 20, 2025
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@dconeybe
Copy link
Contributor

Could you please enable Firestore debug logging (by calling setLogLevel('debug')), reproduce the issue, and provide the logs?

@dconeybe dconeybe added api: firestore needs-info and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Mar 21, 2025
@LanderBeeuwsaert
Copy link
Author

@dconeybe unfortunately not. We see this happening in our error logging that our users have this in our production environment approximately one time every ?4? days on a userbase of +- 2000 users per day.
But we can't enable debugging logging for all our users in production (and would not even be able to get that logging if the issue would occur)

@MarkChrisLevy
Copy link

MarkChrisLevy commented Mar 21, 2025

I have a similar problem, I can reproduce it in my app, however not able to reproduce in test repo. I will try to describe what I see:

  • User is logged in
  • Lots of snapshot listeners are running
  • User uses the app and on some page error is thrown: TypeError: Cannot use 'in' operator to search for 'nullValue' in null - obvious mistake, input data is not validated and instead of an array null is passed to in operator
  • Every other new query/listener or any operation on firestore is not possible and INTERNAL ASSERTION FAILED: Unexpected state is thrown
  • Stack trace of the error
    • fail
    • verifyNotFailed
    • enqueue
    • enqueueAndForget

Firestore configured to use MemoryPersistance. After the "in" error, debug outputs only WebChannelConnection RPC logs, nothing else. The message "1 errors occured during unsubscription" was shown few times just after Unexpected state error, but I wasn't able to reproduce it every single time.

Hope that helps.

@dconeybe
Copy link
Contributor

@MarkChrisLevy Looking in the source code of Firestore, there are 6 places that are obvious that they could cause a TypeError: Cannot use 'in' operator to search for 'nullValue' in null error:

[firebase-js-sdk/packages/firestore/src] $ grep -r "'nullValue' in"
model/values.ts:  if ('nullValue' in value) {
model/values.ts:  if ('nullValue' in value) {
model/values.ts:  return !!value && 'nullValue' in value;
model/values.ts:  if ('nullValue' in value) {
model/values.ts:  if ('nullValue' in value) {
index/firestore_index_value_writer.ts:    if ('nullValue' in indexValue) {

It is plausible that if one of these lines were to cause the noted TypeError then the unsubscribe error could result. However, I really need some logs or a reproducible scenario to dig in further.

@MarkChrisLevy Are you able to reproduce the TypeError with Firestore debug logging enabled, and provide the log?

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

No branches or pull requests

4 participants