apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.34k stars 2.66k forks source link

Fixing undefined issue of observer #11899

Closed takosunil closed 3 months ago

takosunil commented 3 months ago

I am getting "Cannot read properties of undefined (reading 'subscribe')" on Sentry.

apollo-cla commented 3 months ago

@takosunil: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

netlify[bot] commented 3 months ago

Deploy request for apollo-client-docs pending review.

Visit the deploys page to approve it

Name Link
Latest commit def42db7745effde52f745d2a4d1b87f868efe2e
changeset-bot[bot] commented 3 months ago

⚠️ No Changeset found

Latest commit: def42db7745effde52f745d2a4d1b87f868efe2e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

phryneas commented 3 months ago

Hi @takosunil, thank you for the PR!

Unfortunately, it seems that this PR will only avoid an immediate crash, but not resolve the underlying problem (and might possible cause additional problems further down the road as a result).

Could you please provide a bit more context where you encounter this error?

Stack traces, a reproduction or even a test that shows the problem happen?

takosunil commented 3 months ago

Hi @phryneas, Here are the stack traces:

I can't reproduce this issue. But it seems like I am getting this error when I get a 400 response from the backend Response not successful: Received status code 400.

Hope this helps you to understand or investigate the issue.

apollo-client apollo-client-1

phryneas commented 3 months ago

I'm afraid I'll need the full stack trace - there should be like 30 other method calls in there that slowly bring me towards the error.

Also, could you please share your link chain?

takosunil commented 3 months ago

@phryneas Here are all the screenshots of the full stack trace that I have. I don't have a link chain of methods which brings towards the root error as you are expecting.

Hope this is helpful for you to investigate.

Screenshot 2024-06-21 at 8 53 59 pm Screenshot 2024-06-21 at 8 57 35 pm Screenshot 2024-06-21 at 8 58 18 pm Screenshot 2024-06-21 at 9 02 11 pm Screenshot 2024-06-21 at 9 02 30 pm Screenshot 2024-06-21 at 9 02 46 pm Screenshot 2024-06-21 at 9 02 54 pm Screenshot 2024-06-21 at 9 03 01 pm Screenshot 2024-06-21 at 9 03 31 pm

phryneas commented 3 months ago

Is there any chance you can get that without minifaction? I'm interested in these method names, but in their minified form they don't tell me a lot.

image

takosunil commented 3 months ago

@phryneas That's all the information that I can get from Sentry. I can't expand or go to the parent method of those errors on Sentry.

phryneas commented 3 months ago

Maybe you can upload source maps somewhere that would show the correct un-minified function names, line numbers and file names?

Also, is there any chance you can reproduce this?

phryneas commented 3 months ago

I don't have a link chain of methods which brings towards the root error as you are expecting.

I also want to pick this up again - this error is likely caused by a link not returning a correct observable in some edge case. Could you please share your link chain so I can take a second look to verify that we are really not dealing with that?

takosunil commented 3 months ago

I couldn't reproduce this issue. I have provided all the information above that I can get from Sentry.

jerelmiller commented 3 months ago

@takosunil unfortunately without a way to reproduce the issue, we won't be able to move forward with this PR. Its difficult to tell if this is library error or user error at this point without more information. Having a way to reproduce this allows us to add a test that ensures we don't break something in the future with regards to this change and ensures we don't introduce accidental regressions.

For now I'm going to close this PR. If you're able to reproduce this behavior (either in a CodeSandbox or in a test), feel free to open this back up or drop a comment and we'd be happy to take a look again 🙂. Thanks for the contribution!