I've been following the AWS IoT docs trying to get started with the MQTT tutorial at
http://docs.aws.amazon.com/iot/latest/developerguide/protocols.html#mqtt-ws
to set up a WebSocket connection to AWS IoT in a web application. The first step is to initiate a WebSocket connection by making a GET request to an endpoint created by following the steps in the tutorial but I'm getting this error:
XMLHttpRequest cannot load <my endpoint> Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
I was wondering if anyone has encountered this error and if so, how they resolved it?
Here's a link to the code https://github.com/dwyl/learn-aws-iot/blob/2c8035728ec8228e296580c8714f3f7ace870fbe/src/js/components/App.js
Here's an example of how I'm opening the channel. I'm using Cognito unauth roles as a subscriber. I'm using the JS Paho client as well.
http://draw.kyleroche.com/main.js
AWS Labs has also posted an MQTT over WebSockets reference example here: https://github.com/awslabs/aws-iot-examples
Related
I want to eliminate the X.509 certificate by using the MQTT over WSS. But I am confused on how to achieve the same .If anyone have come across the same it would be of great help.
I'm working with a MINIO server and AWS cpp SDK client.
Everything works with HTTP, but after switching to HTTPS I'm getting "NETWORK CONNECTION" errors.
In Wireshark the connection is:
client Hello
server hello
server sends Certificate , Server key exchange, Certificate Request, Server Hello Done
client sends ack
client sends FIN, ACK
When activating debug, aws logs the following error: WinHttpSyncHttpClient [54364] Send request failed: A certificate is required to complete client authentication
What works:
AWS CLI to the MINIO (works with TLS 1.3 so the connection looks different)
The same SDK with no SSL connection (when turning if off in MINIO as well).
The same SDK works well with AWS S3 (with SSL).
What was tried and does not work:
Turning "verifySSL" on and off
Sending and not sending region
Manually switching to HTTP 1.1
Does anyone have ideas on how to identify\solve the problem?
We managed to bypass the problem by switching to OpenSSL instead of WinHttpSyncHttpClient, by turning the relevant flag in AWS SDK CMake file.
I have a webpage that connects to AWS IoT using MQTT through a websocket with an unregistered AWS Cognito identity.
When i go to this page with a web browser (I have tested chrome,firefox,safari and mobile versions) it all works and I am connected.
I want to test the page using puppeteer through docker so i can deploy lots of machines to stress test the page.
When i use puppeteer from my local machine - it works. However, when i try to use puppeteer from inside a docker instance it doesn't.
I am using alekzonder/puppeteer:latest and a simple script that just goes to the page and waits 10 seconds. The page itself loads but the websocket connection fails:
failed: Error during WebSocket handshake: Unexpected response code: 403
Is there something i need to add to the docker image to allow websockets? or does this have something to do with the cognito identity created from a docker instance?
I'm running into a really frustrating error with trying to bridge mosquitto to the AWS IoT MQTT system. I set it up following this guide:
https://aws.amazon.com/blogs/iot/how-to-bridge-mosquitto-mqtt-broker-to-aws-iot/
Which at first seemed to work. I was able to see messages in he AWS IoT console when I subscribed to it. Then I restarted mosquitto and I'm just getting this error over and over again:
1529722121: OpenSSL Error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
1529722121: Socket error on client local.bridgeawsiot, disconnecting.
1529722151: Bridge local.bridgeawsiot doing local SUBSCRIBE on topic localgateway_to_awsiot
1529722151: Bridge local.bridgeawsiot doing local SUBSCRIBE on topic both_directions
1529722151: Connecting bridge awsiot (a10cxxxxxxxxxx.iot.us-west-2.amazonaws.com:8883)
1529722182: Connecting bridge awsiot (a10cxxxxxxxxxx.iot.us-west-2.amazonaws.com:8883)
I've verified multiple times that the certificates that I'm using are the correct ones, I've also checked that the Thing has a policy attached to it and that the certificates are activated. I made sure that the rootCA.pem file is the one issued from Verisign. I'm at a loss as to why the broker is not working. The host OS is Ubuntu 18.04 running the bundled version of mosquitto. Any help would be appreciated.
I figured out what the issue was. I was using the CLI to retrieve my IoT endpoint and my default region was set to us-west-2. The certificates that I created are in us-east-1.
I am trying to integrate the Mule Amazon SNS connector behind the corporate proxy and having much trouble to bypass the proxy. It always give me this error:
[[snstest].HTTP_Listener_Configuration.worker.01]
com.amazonaws.http.AmazonHttpClient: Unable to execute HTTP request:
Connection to https://sns.us-east-1.amazonaws.com refused
Exception stack is:
Unable to execute HTTP request: Connection to https://sns.us-east-1.amazonaws.com refused
Failed to invoke createTopic. Message payload is of type: NullPayload
org.mule.modules.sns.processors.CreateTopicMessageProcessor:129
I believe the issue is the proxy trying to block the connection between the application and the amazon endpoint. When I try it at home with direct internet, it worked. Also, I have also tried http:connector and http:proxy to configure the proxy and it has not worked at all.
Check the secret key and access key. Issue is not with proxy its problem in credentials.