aws-amplify / docs

AWS Amplify Framework Documentation
https://docs.amplify.aws
Apache License 2.0
487 stars 1.06k forks source link

Subscribe to real-time events in Nextjs is very unclear #7915

Open rpostulart opened 3 months ago

rpostulart commented 3 months ago

Describe the content issue: The explanation about data subscription with nextjs with client components and server components is very unclear. I can't get it working with the information on this page. For example I try to set up a notifications component and want to listen to new notifications and show a red circle on the message icon when new notifications are coming in.

URL page where content issue is: https://docs.amplify.aws/nextjs/build-a-backend/data/subscribe-data/

rpostulart commented 2 months ago

An example somewhere would also be fine for now. I am looking for a way to move forward.

chrisbonifacio commented 3 weeks ago

Hi @rpostulart 👋 thank you for opening this issue.

It's a bit unclear what the issue might be. Can you explain a bit more what part of the documentation is unclear or what you are trying to do?

It sounds like there might be some confusion between subscriptions with server-side filters (AppSync GraphQL server) and subscriptions in server components (Next.js server). Subscriptions are not supported for server-side environments such as a server component, they are mean to be used on the client-side.

Also, please provide sample code from your application to demonstrate how you are trying to set up the subscription. This would help us reproduce the behavior you're observing and find the cause of the issue.