question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Potential exception when using rxjs 7 in Angular 13

See original GitHub issue

Environment:

  • angular: 13.1.0
  • rxjs: 7.4.0

Stacktrace:

TypeError: Cannot read properties of undefined (reading 'isStopped')
    at error (Subscriber.js:35:18)
    at IDBTransaction.error [as __zone_symbol__ON_PROPERTYerror] (ngx-indexed-db.js:106:13)
    at IDBTransaction.B (zone.js:803:43)
    at ir.invokeTask (zone.js:434:35)
    at Object.onInvokeTask (core.mjs:25437:33)
    at ir.invokeTask (zone.js:433:64)
    at ir.runTask (zone.js:205:51)
    at ir.invokeTask [as invoke] (zone.js:516:38)
    at pr (zone.js:1656:18)
    at IDBTransaction.Er (zone.js:1682:21)

This happens when calling getAllKeysByIndex and it fails. When creating the transaction obs.error is directly passed on and I guess in rxjs7 the callback uses a this which “gets lost” due to the closure there.

See https://github.com/assuncaocharles/ngx-indexed-db/blob/c020aed2321078f8ca41d1690f7d55a16098431e/projects/ngx-indexed-db/src/lib/ngx-indexed-db.service.ts#L536

I have also seens this in other places in code. Everything here is just a guess, but maybe someone else could clarify.

I have a rather large app where I can reproduce the issue, but could not yet create a minimal repro for it.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
aparzicommented, Apr 8, 2022

Hi @HFTSOL, I hope I can take a look at the problem these days. I can’t promise you anything because this is a new issue for me

2reactions
ZachHabercommented, Feb 25, 2022

I will say, that I ended up just using https://www.npmjs.com/package/idb and just using indexeddb directly instead of through Angular, and it’s working pretty well for me. Sometimes framework-agnostic solutions are all you need.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Breaking Changes in Version 7 - RxJS
This is potentially breaking in edge cases for node applications, which may be configured to terminate for unhandled exceptions. In the unlikely event...
Read more >
How to set a timeout config for lastValueFrom() using RxJS 7 ...
In my case I send a get request to the server to check if the server is available or not. The main function...
Read more >
Handling Exceptions Using the Angular HttpClient Service
In this guide, you learned how to manage HTTP exceptions within your app. You have seen how the RxJs catchError operator can be...
Read more >
Error handling in Rxjs Observables | Angular 13 | 2022
Error handling in Rxjs Observables in Angular 13. We explore the try/catch block for synchronous error handling. We explore the catchError ...
Read more >
Support for rxjs 7 · Issue #41897 · angular/angular - GitHub
We're exploring how to support both 6 and 7 for projects that want to opt into it earlier.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found