awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
917 stars 265 forks source link

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'subscriptionFailedCallback') #684

Open divsbhalala opened 2 years ago

divsbhalala commented 2 years ago

I implement the subscription in my app and subscription working fine but in sentry and console I am seeing this error

cefeboru commented 2 years ago

@divsbhalala were you able to find what was causing this issue? We are having a lot of reports in sentry as well

AndrzejSala commented 2 years ago

We have the same issue. It can be triggered by network error and then there are errors like this on reconnect / refetch.

AndrzejSala commented 2 years ago

@divsbhalala Could you share your package.json?

jacobgranberry commented 2 years ago

Same happening here, been happening for months.

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'subscriptionFailedCallback')
    at AppSyncRealTimeSubscriptionHandshakeLink.<anonymous> (realtime-subscription-handshake-link.js:325:1)
    at step (realtime-subscription-handshake-link.js:57:1)
    at Object.next (realtime-subscription-handshake-link.js:38:1)
    at fulfilled (realtime-subscription-handshake-link.js:29:1)
arbaaz commented 2 years ago

Same here.

arbaaz commented 2 years ago

Any updates on this?

ryancrunchi commented 2 years ago

Duplicate of https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/509

heanfig commented 1 year ago

Any updates ?

    "@apollo/client": "^3.5.10",
    "aws-appsync-subscription-link": "^3.1.2",
shawngustaw commented 11 months ago

Anyone have any ideas? I'm hitting this using Next with strict mode turned off. I managed to temporarily work around this by delaying setting up the subscription using a setTimeout(() => {enableSubscriptions(true)}, 0) on mount, but don't know how stable this is.

shawngustaw commented 11 months ago

@heanfig could you test/verify this PR to fix this? https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/747. To build I had to add types: [] to the tsconfig.json but then you can run yarn prepare && yarn pack and then yarn add ../path/to/package.tar.gz the file that gets created from yarn pack.

omerson commented 8 months ago

in my case skip: !idToSubscribeOn solved the problem

objectiveSee commented 8 months ago

@omerson can you elaborate on how this fixed your problem? Do you have a code example? I am facing the same issue today.

shawngustaw commented 8 months ago

@omerson can you elaborate on how this fixed your problem? Do you have a code example? I am facing the same issue today.

I believe this happens specifically during navigation in nextJS so just delaying setting up the subscription until after the page renders seems to work. I have a PR that fixes this that we've been running in prod as a patch (using patch-package) for a couple days without issue and I haven't seen this pop up again. Trying to get someone from AWS to review but it seems like this package is abandoned.

shamseer-ahammed commented 7 months ago

+1

@shawngustaw did u fix it ?

shawngustaw commented 7 months ago

@shamseer-ahammed yes using a patch with this PR:

https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/747

gong917727564 commented 4 months ago

Any updates on this?

ivadenis commented 4 months ago

facing the same issue in nextjs app

shamseer-ahammed commented 4 months ago

@gong917727564 @ivadenis tried with aws-appsync-subscription-link@3.1.3 ?