aws-mobile-appsync-sdk-js icon indicating copy to clipboard operation
aws-mobile-appsync-sdk-js copied to clipboard

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

Open divsbhalala opened this issue 4 years ago • 19 comments

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

divsbhalala avatar Oct 08 '21 08:10 divsbhalala

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

cefeboru avatar Nov 26 '21 15:11 cefeboru

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

AndrzejSala avatar Jan 17 '22 13:01 AndrzejSala

@divsbhalala Could you share your package.json?

AndrzejSala avatar Jan 18 '22 07:01 AndrzejSala

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)
    ```

jacobgranberry avatar Mar 01 '22 21:03 jacobgranberry

Same here.

arbaaz avatar Mar 15 '22 14:03 arbaaz

Any updates on this?

arbaaz avatar May 09 '22 08:05 arbaaz

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

ryancrunchi avatar Jun 07 '22 10:06 ryancrunchi

Any updates ?

    "@apollo/client": "^3.5.10",
    "aws-appsync-subscription-link": "^3.1.2",

heanfig avatar Jul 16 '23 22:07 heanfig

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 avatar Aug 10 '23 17:08 shawngustaw

@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.

shawngustaw avatar Aug 11 '23 21:08 shawngustaw

in my case skip: !idToSubscribeOn solved the problem

omerson avatar Oct 23 '23 09:10 omerson

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

objectiveSee avatar Oct 26 '23 15:10 objectiveSee

@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.

shawngustaw avatar Oct 26 '23 15:10 shawngustaw

+1

@shawngustaw did u fix it ?

shamseer-ahammed avatar Dec 04 '23 06:12 shamseer-ahammed

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

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

shawngustaw avatar Dec 04 '23 18:12 shawngustaw

Any updates on this?

gong917727564 avatar Feb 29 '24 08:02 gong917727564

facing the same issue in nextjs app

ivadenis avatar Mar 01 '24 09:03 ivadenis

@gong917727564 @ivadenis tried with [email protected] ?

shamseer-ahammed avatar Mar 01 '24 10:03 shamseer-ahammed