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.

Calling map of QueryObservable throws an error

See original GitHub issue

Intended outcome: I am trying to map the result of QueryObservable.

Actual outcome: TypeError: Cannot read property ‘generateQueryId’ of undefined

How to reproduce the issue:

apolloClient
  .watchQuery({ query })
  .map(result => result.data)

Versions 3.0.0-beta.43

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
lennyburdettecommented, Sep 21, 2020

Workaround:

import Observable from 'zen-observable';

return Observable.from(apolloClient.watchQuery({ query }))
  .map(result => result.data);
1reaction
elm-sufcommented, Jul 21, 2020

i’m having the same problem using “@apollo/client”: “^3.0.2”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error being thrown when observable is inside another ...
MergeMap and Map are not accepting error handling. You are using the mergeMap argument resultSelector that is throwing the error you see.
Read more >
Cannot call map on the observable returned by watchQuery
import { Observable } from 'rxjs'; Observable.create(observer => { client.watchQuery({ query }).subscribe({ next: observer.next, error: ...
Read more >
RxJs Error Handling: Complete Practical Guide
The catchError operator takes as input an Observable that might error out, and starts emitting the values of the input Observable in its...
Read more >
Handling operation errors - Apollo GraphQL Docs
By default, Apollo Client throws away partial data and populates the error.graphQLErrors array of your useQuery call (or whichever hook you're using).
Read more >
RxJS - Error Handling Operators - DEV Community ‍ ‍
Returns an Observable that mirrors the source Observable with the exception of an error. If the source Observable calls error, this method will ......
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