PubSub Websocket: "AMQJS0008I Socket closed." when trying to subscribe
See original GitHub issueDescribe the bug
I followed the tutorial to create Auth for my React App, then I followed the tutorial on using PubSub with AWS IoT. The first Problem I encountered was that using the pubsub endpoint: wss://xxxxxxx-iot.eu-central-1.amazonaws.com/mqtt
resulted in a “legancy certificate error” (I am using chrome) so i replaced the endpoint with wss://xxxxxxx-ats.iot.eu-central-1.amazonaws.com/mqtt
. Now as soon as I try to subscribe I get the following error: {invocationContext: undefined, errorCode: 8, errorMessage: "AMQJS0008I Socket closed."}
I have attached the Policy using the command from the tutorial, but since attach-principal-policy is deprecated I also tried: aws iot attach-policy --policy-name 'myIOTPolicy' --target 'eu-central-1:xxxxxxxxxxxxxxxxxxx'
To Reproduce
- Follow all the steps from the tutorial for setting up a react app, adding auth and using PubSub. Expected behavior A clear and concise description of what you expected to happen.
Desktop (please complete the following information):
- OS: WSL
- Browser Chrome
- Version 71.0.3578.98
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:15
Top GitHub Comments
I was able to resolve this error by attaching the AWSIoTDataAccess policy to the Cognito AuthRole
Had the same error, changing IOT Core policy solved the problem for me:
My guess is that previous policy gave permission to subscribe/publish to topics, but didn’t gave the permission to connect. Amplify JS PubSub docs can be improved IMHO.