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.

Error: Subscriptions are not supported for Server-Side Rendering (SSR)

See original GitHub issue
useEffect(()=>{
  const subscription = API.graphql(
      graphqlOperation(subscriptions.onCreateTodo)
  ).subscribe({
      next: (todoData) => console.log(todoData)
  });
},[]);

Why do subscriptions not work in the mounted hook?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ericclemmonscommented, Nov 19, 2020

@mellymelon You’re absolutely right. This is a bug from:

https://github.com/aws-amplify/amplify-js/pull/6937

We need both isNode and ssr checks.

We’ll get this fixed for you!

0reactions
github-actions[bot]commented, Nov 24, 2021

This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server-side rendering - Apollo GraphQL Docs
Server -side rendering (SSR) is a performance optimization for modern web apps. It enables you to render your app's initial state to raw...
Read more >
Deploy server-side rendered apps with Amplify Hosting
Describes AWS Amplify deployment and hosting support for apps with server-side rendering (SSR).
Read more >
Angular5 Server side rendering, external Api data service ...
And there is no error in SSR mode. I made an another api server and it makes logs whenever the function is called....
Read more >
Server-Side Rendering - tRPC
When you enable SSR, tRPC will use getInitialProps to prefetch all queries on the server. This results in problems like this when you...
Read more >
[SSR] setTimeout is not supported in server-rendered Javascript
Make sure you have everything setup correctly... client side code separate from server side code. https://reactjs.net/bundling/webpack.html Or ...
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