firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.74k stars 868 forks source link

FIRESTORE (10.9.0) INTERNAL ASSERTION FAILED: Unexpected state #8189

Open kmorgan8588 opened 4 weeks ago

kmorgan8588 commented 4 weeks ago

Operating System

Windows 10

Browser Version

Chrome 124

Firebase SDK Version

10.9.0

Firebase SDK Product:

Firestore

Describe your project's tooling

React application with Webpack

Describe the problem

Customer using our application in production attempted to update a document, and it failed with this error. We were able to parse the error stack seen below. Looks like the async_queue has already failed?

Stack trace:

../node_modules/.pnpm/@firebase+firestore@4.5.0_@firebase+app@0.9.29/node_modules/@firebase/firestore/src/util/assert.ts:40:8:null
../node_modules/.pnpm/@firebase+firestore@4.5.0_@firebase+app@0.9.29/node_modules/@firebase/firestore/src/util/async_queue_impl.ts:238:6:fail
../node_modules/.pnpm/@firebase+firestore@4.5.0_@firebase+app@0.9.29/node_modules/@firebase/firestore/src/util/async_queue_impl.ts:119:9:lu
../node_modules/.pnpm/@firebase+firestore@4.5.0_@firebase+app@0.9.29/node_modules/@firebase/firestore/src/util/async_queue_impl.ts:93:9:enqueue
../node_modules/.pnpm/@firebase+firestore@4.5.0_@firebase+app@0.9.29/node_modules/@firebase/firestore/src/util/async_queue.ts:193:20:enqueueAndForget
../node_modules/.pnpm/@firebase+firestore@4.5.0_@firebase+app@0.9.29/node_modules/@firebase/firestore/src/util/async_queue.ts:160:45:handleDelayElapsed

Steps and code to reproduce issue

Steps to reproduce: Unknown, we've seen these internal assertions occur in the past, but it's intermittent and not consistent to reproduce

cherylEnkidu commented 3 weeks ago

Hi,

If you run into this issue when you develop locally. Could you please enable the debug log for us to get more info of this failure?

Also, could you please try to downgrade your SDK version to 10.6.0 to see if that fix your problem?

michaelAtCoalesce commented 3 weeks ago

@cherylEnkidu - kyle and i are working on this together so i am responding on his behalf.

we cannot turn on debug logging for this, as we do not see it locally, and we do not have a recreate case. it happens very intermittently in production with customers (thus why we cannot turn on logging)

we are happy to try custom builds with specific logging for this issue if needed (maybe you can add some telemetry or logs right before the offending assert fires?)- but turning on all debug logging is a no-go for us.

cherylEnkidu commented 2 weeks ago

Hi @michaelAtCoalesce ,

Thank you for the reply! Have you tried to downgrade the SDK version to 10.6.0? This version hasn't received any connectivity issue reports yet.

google-oss-bot commented 1 week ago

Hey @kmorgan8588. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

michaelAtCoalesce commented 1 week ago

@cherylEnkidu we cannot downgrade at this time...

mlahp7 commented 5 days ago

Hi,

If you run into this issue when you develop locally. Could you please enable the debug log for us to get more info of this failure?

Also, could you please try to downgrade your SDK version to 10.6.0 to see if that fix your problem?

Hello @cherylEnkidu, We are also seeing this happen on Firestore (10.8.0) via Angularfire (17.0.1).
iPadOS Version: 17.3.1

Our only way of reproducing this error is by logging in and returning a few days later. After returning, any call to Firestore is met with the error: [2024-05-13T14:03:25.474Z] @firebase/firestore:"Firestore (10.8.0): FIRESTORE (10.8.0) INTERNAL ASSERTION FAILED: Unexpected state"

We have enabled the debug log via the enableLogging(true) function found here: import { enableLogging } from '@angular/fire/database';

I'm not sure if the function succeeded but here is a sample of what we received:

[Error] [2024-05-13T13:38:40.309Z]  @firebase/firestore: – "Firestore (10.8.0): FIRESTORE (10.8.0) INTERNAL ASSERTION FAILED: Unexpected state"
    defaultLogHandler (vendor.js:342310)
    error (vendor.js:342391)
    __PRIVATE_logError (vendor.js:26198)
    fail (vendor.js:26275)
    au (vendor.js:45192)
    enqueue (vendor.js:45105)
    enqueueAndForget (vendor.js:45090)
    (anonymous function) (vendor.js:40637)
    (anonymous function) (vendor.js:40612)
    mo (vendor.js:39963)
    (anonymous function) (vendor.js:40211:84)
    (anonymous function) (vendor.js:40160)
    ib (vendor.js:342913)
    C (vendor.js:342881)
    (anonymous function) (vendor.js:344640)
    qc (vendor.js:343511:130)
    rc (vendor.js:343386)
    (anonymous function) (vendor.js:343362)
    (anonymous function) (vendor.js:343303)
    ib (vendor.js:342913)
    C (vendor.js:342881)
    Ad (vendor.js:344041:131)
    (anonymous function) (vendor.js:344038)
    (anonymous function) (vendor.js:344035)
    od (vendor.js:343944)
    (anonymous function) (vendor.js:343910)
    onInvoke (vendor.js:253910)
    run (polyfills.js:369)
    (anonymous function) (polyfills.js:1444)
    onInvokeTask (vendor.js:253587)
    onInvokeTask (vendor.js:253899)
    runTask (polyfills.js:415)
    drainMicroTaskQueue (polyfills.js:782)
[Error] [2024-05-13T13:38:40.310Z]  @firebase/firestore: – "Firestore (10.8.0): FIRESTORE (10.8.0) INTERNAL ASSERTION FAILED: Unexpected state"
    defaultLogHandler (vendor.js:342310)
    error (vendor.js:342391)
    __PRIVATE_logError (vendor.js:26198)
    fail (vendor.js:26275)
    au (vendor.js:45192)
    enqueue (vendor.js:45105)
    enqueueAndForget (vendor.js:45090)
    (anonymous function) (vendor.js:40637)
    (anonymous function) (vendor.js:40612)
    mo (vendor.js:39963)
    (anonymous function) (vendor.js:40211:84)
    (anonymous function) (vendor.js:40160)
    ib (vendor.js:342913)
    C (vendor.js:342881)
    (anonymous function) (vendor.js:344640)
    qc (vendor.js:343511:130)
    rc (vendor.js:343386)
    (anonymous function) (vendor.js:343362)
    (anonymous function) (vendor.js:343303)
    ib (vendor.js:342913)
    C (vendor.js:342881)
    Ad (vendor.js:344041:131)
    (anonymous function) (vendor.js:344038)
    (anonymous function) (vendor.js:344035)
    od (vendor.js:343944)
    (anonymous function) (vendor.js:343910)
    onInvoke (vendor.js:253910)
    run (polyfills.js:369)
    (anonymous function) (polyfills.js:1444)
    onInvokeTask (vendor.js:253587)
    onInvokeTask (vendor.js:253899)
    runTask (polyfills.js:415)
    drainMicroTaskQueue (polyfills.js:782)

cherylEnkidu commented 5 days ago

Hi @kmorgan8588 @michaelAtCoalesce @mlahp7 ,

Could you please tried upgrade to version greater than 10.11.1 ?

mlahp7 commented 4 days ago

Hi @kmorgan8588 @michaelAtCoalesce @mlahp7 ,

Could you please tried upgrade to version greater than 10.11.1 ?

Yes, it looks like AngularFire just released a version that updates the firebase dependency to ^10.12.0. I'll report back when I've had a chance to make the changes

luke-rogers commented 3 days ago

Also seeing this issue. I'll attempt to capture some logs and update this ticket.

@cherylEnkidu What is it in version 10.12.0 that we might expect to resolve the issue?