Open Jefftopia opened 1 year ago
I'm using Apollo Client
on a React App, connecting to AppSync. I think it's the same service used by Amplify.
I was not able to establish a connection with the library graphql-ws
, but I managed to do so with subscriptions-transport-ws
(that's deprecated!). So I'm following this discussion to see if there's a way to connect using graphql-ws
@70nyIT Sounds like you are connecting from a browser environment, not NodeJs. It is insecure to use IAM auth in the Browser. But it is a requirement for me.
Yeah, I realized after you were using IAM. Nope, I'm not going to use IAM roles in the browser 😅
Describe the content issue: The AWS Amplify docs describe how to connect to amplify from a node server, for example, if you are restricted to using IAM auth. While the nodejs code sample is helpful, there's no example for how to establish a graphql websocket connection for a subscription to appsync.
I have scoured the internet the past few days and cannot find any good documentation or examples of how to do this. I can share what didn't work - I have a couple of attempts based on what amplify does share, but unfortunately my approach always returns a nondescript 400 "network" error. I will include a code snippet for reference, but I am really looking for clear documentation.
Thanks!
URL page where content issue is: https://docs.amplify.aws/lib/graphqlapi/graphql-from-nodejs/q/platform/js/
Erroneous reference code (based off the amplify site):