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.

Connection failed Max number of 100 subscriptions reached

See original GitHub issue

Dear Support Team

I am using AWS Amplify in my React Native mobile app and Web app, they are real time app and they need to change data many times in short time, using GraphQL with Subscription Method

At the beginning everything works fine but after seconds It drops and get me an error message

"Connection failed: {\"errors\":{\"errorType\":\"MaxSubscriptionsReachedError\",\"message\":\"Max number of 100 subscriptions reached\"}}"

and sometimes it shows me another error like websocket is unconnected

My question

What should I do to get unlimited subscription requests ?

thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
MedNabilEssefaihicommented, Jun 2, 2021

Dear @chrisbonifacio

I already fixed the problem

The code was:

  useEffect(() => {
    //update when inService go to the next call
    API.graphql({
      query: subscriptions.onChangeInService,
      authMode: "AWS_IAM",
    }).subscribe({
      next: ({ provider, value }) => {
           // my code ...
      },
      error: (error) => console.log("update inservice ", error.error.errors[0]),
    });
  }, []);

and the solution was adding .unsubscribe(); like this:

 useEffect(() => {
    const changeInservice = API.graphql({   //  <== add const changeInservice 
      query: subscriptions.onChangeInService,
      authMode: "AWS_IAM",
    }).subscribe({
      next: ({ provider, value }) => {
         // my code ...
      },
      error: (error) => console.log("update inservice ", error.error.errors[0]),
    });

    return () => changeInservice.unsubscribe();    // <== add this one
  }, []);

⚠️ I find the solution in these sources : ⚠️ video: https://www.youtube.com/watch?v=HZUlQ7Z2xHQ&t=2154s AWS awmplify docs: https://docs.amplify.aws/lib/graphqlapi/subscribe-data/q/platform/js#using-amplify-graphql-client

Thank you Sir for your answer

1reaction
chrisbonifaciocommented, Jun 2, 2021

Awesome! I had a feeling it might’ve been the side effect cleanup lol

Thank you for the update and glad we could help! Enjoy the rest of your day, sir 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I restrict AWS Amplify DataStore's event subscriptions ...
When I use AWS Amplify DataStore in my app I get multiple errors of the form [WARN] 10:54.853 DataStore - subscriptionError, Connection ......
Read more >
How to Fix the 508 Resource Limit is Reached Error - Kinsta
Learn how to identify and fix the "508 Resource Limit is Reached" error and get your site back online in no time!
Read more >
Why did I get a maximum devices error on my mobile app
This message indicates you have exceeded the maximum number of active devices. Please log out of a device to solve the issue.
Read more >
Shared drive limits in Google Drive
Google Workspace productivity guideThe number of items, members, ... A file in a shared drive can be directly shared with a maximum of...
Read more >
Amazon VPC quotas - Amazon Virtual Private Cloud
You can increase this limit so that you can have 100s of VPCs per Region. ... Outstanding VPC peering connection requests, 25, Yes,...
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