Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS AppSync Subscription Connection Issue – Assistance Needed #14012

Closed
3 tasks done
rahul-huma opened this issue Nov 15, 2024 · 4 comments
Closed
3 tasks done

AWS AppSync Subscription Connection Issue – Assistance Needed #14012

rahul-huma opened this issue Nov 15, 2024 · 4 comments
Assignees
Labels
GraphQL Related to GraphQL API issues pending-maintainer-response Issue is pending a response from the Amplify team. question General question V5

Comments

@rahul-huma
Copy link

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

GraphQL API

Amplify Version

v5

Amplify Categories

api

Backend

None

Environment information

# Put output below this line


Describe the bug

Hello,

I'm facing an issue with AWS AppSync subscriptions where the connection intermittently breaks, and I've been troubleshooting it for a couple of days now. I am using aws amplify Gen 1(v5). Here’s what happens:

  1. Error Message: I frequently encounter the following error:

    A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received.
    
  2. Reproducibility: This issue typically occurs in the following scenarios:

    • When the browser window with the AppSync connection remains idle for 2–4 hours.
    • After any network disruption (e.g., intermittent internet connection).
  3. Current Setup: I have implemented a retry logic to reconnect when the connection drops. However, I'm struggling to accurately detect whether the subscription is active after reconnection attempts, as the error above can still appear unexpectedly.

I suspect this error is contributing to the connection breaking, and I'd like to confirm if there are any known solutions for handling AWS AppSync subscription stability in long-running or idle scenarios. Additionally, if you have advice on reliably determining the connection status, it would be greatly appreciated.

Thank you in advance for your help!

Expected behavior

I should always retry to connect to the subscription

Reproduction steps

I am just using Gen 1 v5 of this library.

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending a response from the Amplify team. labels Nov 15, 2024
@cwomack cwomack added GraphQL Related to GraphQL API issues V5 labels Nov 15, 2024
@chrisbonifacio
Copy link
Member

chrisbonifacio commented Nov 19, 2024

Hi @rahul-huma 👋 thanks for raising this issue.

I see that you are using v5 of amplify. is there any reason you have not upgraded to v6 yet?

in any case, I believe in v5 you should still have access to the subscription connection states through the Hub listener utility.

Here's the documentation for that:

https://docs.amplify.aws/gen1/react/build-a-backend/graphqlapi/subscribe-data/#subscription-connection-status-updates

there is an info accordion below that that shows how you can troubleshoot connection issues and automated reconnection.

Please give that a look, try it out, and let us know if it helps!

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Nov 19, 2024
@chrisbonifacio chrisbonifacio added pending-community-response Issue is pending a response from the author or community. and removed pending-triage Issue is pending triage labels Nov 19, 2024
@chrisbonifacio chrisbonifacio self-assigned this Nov 19, 2024
@chrisbonifacio chrisbonifacio added the question General question label Nov 19, 2024
@chrisbonifacio
Copy link
Member

another thing that might be worth confirming is whether this error occurs in other browsers or in incognito mode for chrome?

the exact error message seems to be related to a chrome.addListener() method.

some other developers have mentioned chrome extensions that were causing the same errors in apps they were building.
can you check this thread and see if it helps unblock you?

https://stackoverflow.com/questions/72494154/a-listener-indicated-an-asynchronous-response-by-returning-true-but-the-messag

@chrisbonifacio
Copy link
Member

Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you.

Thank you!

@chrisbonifacio chrisbonifacio closed this as not planned Won't fix, can't repro, duplicate, stale Nov 26, 2024
@github-actions github-actions bot removed the pending-community-response Issue is pending a response from the author or community. label Nov 26, 2024
@rahul-huma
Copy link
Author

rahul-huma commented Dec 13, 2024

Hi @chrisbonifacio, Thanks For your response and sorry for not responding earlier. I think this particular issue was not because of amplify, But there was a problem that we were facing with v5 version that we were using in react.

In that version, We were not able to find anything which tells us, if the user is connected to the appsync subscription or not. We were kind of blocked because there were a lot of problems that we faced with that, There were situations like when user's internet connection broke for sometime and it came back, The websocket was not connecting it automatically sometimes. This happenned when users were switching their wifi connections as we saw.

Because our application was heavily reliant on appsync subscription events, So we thought of adding something in the FE, that would tell us if connection of user with appsync broken or not, So we can show some status to user according to that.

This was the whole point of me opening this issue, To check if this has to do with library itself or not.

To fix this now, We decided to upgrade the library to v6. As the new version had the thing that we wanted to incorporate. So in our case, upgrading worked until now (because upgrade is in testing stages right now).

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GraphQL Related to GraphQL API issues pending-maintainer-response Issue is pending a response from the Amplify team. question General question V5
Projects
None yet
Development

No branches or pull requests

3 participants