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

heartbeatService.ts: cannot read properties of undefined (reading 'length') #7736

Closed
malk90 opened this issue Oct 30, 2023 · 9 comments
Closed

Comments

@malk90
Copy link

malk90 commented Oct 30, 2023

Operating System

Windows >=10

Browser Version

Opera 102.0.0

Firebase SDK Version

10.5.2

Firebase SDK Product:

Analytics, Auth, Messaging, Performance

Describe your project's tooling

React app with webpack, cordova, typescript

Describe the problem

Opera users have repeated errors from time to time, most of all in version 102, but it started with 101

In file /node_modules/@firebase/app/src/heartbeatService.ts line 132 error
Cannot read properties of undefined (reading 'length')

this._heartbeatsCache.heartbeats.length === 0

Steps and code to reproduce issue

this._heartbeatsCache.heartbeats.length === 0

@malk90 malk90 added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Oct 30, 2023
@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.

@argzdev argzdev added api: core and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Oct 30, 2023
@DellaBitta
Copy link
Contributor

Hi @malk90,

I wasn't able to reproduce this with my own test app. Could you provide a reproducible test app or the code that causes this behavior? Thanks!

DellaBitta added a commit that referenced this issue Nov 7, 2023
There seems to be a potential scenario in the heartbeat service running in the Opera browser (#7736) that the heartbeatCache exists but it's an empty object. The code implementation encounters errors in these cases as it assumes the heartbeatCache has a heartbeats array. This change better detects these empty object cases and treats them in a similar way as if there's nothing in the heartbeatCache.
@malk90
Copy link
Author

malk90 commented Nov 7, 2023

hi, no, unfortunately I can’t help with the code, but if you look at the code, you’ll immediately see the error

@DellaBitta
Copy link
Contributor

DellaBitta commented Nov 10, 2023

Hi @malk90,

We still couldn't reproduce this issue, unfortunately. However, we just shipped v10.6.0 which includes some better checks around the state of the HeartBeat object that should avoid the error that you're seeing. Could you please give the new release a test?

If you still encounter issues then could you post a minimum reproducible test case so we can better attempt to reproduce the probelm ourselves? Thanks!

prameshj pushed a commit that referenced this issue Nov 13, 2023
There seems to be a potential scenario in the heartbeat service running in the Opera browser (#7736) that the heartbeatCache exists but it's an empty object. The code implementation encounters errors in these cases as it assumes the heartbeatCache has a heartbeats array. This change better detects these empty object cases and treats them in a similar way as if there's nothing in the heartbeatCache.
@malk90
Copy link
Author

malk90 commented Nov 16, 2023

there are significantly fewer errors, perhaps not everyone has switched to the new version yet
there is a similar error in another line:

this._heartbeatsCache.heartbeats.some(

I think we need more time, I’ll write back a little later, but I would still add checks if null for 'heartbeatService'. Thanks!

@DellaBitta
Copy link
Contributor

Hi @malk90,

We've put some more protections in the upcoming release of 10.7.0 which should be released soon. I'll post here when it's out. Thanks!

@DellaBitta
Copy link
Contributor

Hi @malk90,

v10.7.0 was released on Monday. Can you check to see if this clears up your issue? Thanks.

@google-oss-bot
Copy link
Contributor

Hey @malk90. 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!

@DellaBitta
Copy link
Contributor

I'm going to close this issue since we released a change to address this issue and we haven't heard if it's still affecting your app after an upgrade. If you find that the issue persists at a later time, please create a new GitHub issue and link to this one. Thank you!

@firebase firebase locked and limited conversation to collaborators Jan 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants