Websocket setup failed to establish HTTP connection, error 1029 (AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE)
See original GitHub issueConfirm by changing [ ] to [x] below to ensure that it’s a bug:
- I’ve searched for previous similar issues and didn’t find any solution
Describe the bug A clear and concise description of what the bug is. Can’t connect to IoT message broker
SDK version number
"aws-crt": "^1.0.6",
"aws-iot-device-sdk-v2": "^1.0.4",
"aws-sdk": "^2.643.0",
Platform/OS/Hardware/Device What are you running the sdk on? linux (arch-linux 5.5.13-arch1-1)
To Reproduce (observed behavior)
const client_bootstrap = new io.ClientBootstrap();
const config_builder = iot.AwsIotMqttConnectionConfigBuilder.new_with_websockets({
credentials_provider: auth.AwsCredentialsProvider.newDefault(client_bootstrap),
region: AWS_REGION,
});
config_builder.with_clean_session(false);
config_builder.with_client_id(uuid());
config_builder.with_endpoint(`data.iot.${AWS_REGION}.amazonaws.com`);
const config = config_builder.build();
const client = new mqtt.MqttClient(client_bootstrap);
const connection = client.new_connection(config);
const topic = `tournaments`;
const subscribe = async () => {
const connected = await connection.connect();
if (!connected) {
throw Error('IoT connection failed!');
}
console.log(`Subscribe to ${topic}`);
const request = await connection.subscribe(topic, mqtt.QoS.AtLeastOnce, (_, payload) => {
const events: ChangeEvent[] = JSON.parse(payload.toString());
console.log(events);
processChangeEvents(events);
});
console.log(request);
};
subscribe();
Expected behavior A clear and concise description of what you expected to happen. for client to subscribe to topic
Logs/output If applicable, add logs or error output.
[ERROR] [2020-03-30T18:38:27Z] [00007efbe7fff700] [socket] - id=0x7efbe0004ca0 fd=26: connect failed with error code 101.
[ERROR] [2020-03-30T18:38:27Z] [00007efbe7fff700] [channel-bootstrap] - id=0x4dc8910: failed to create socket with error 1049
[ERROR] [2020-03-30T18:38:27Z] [00007efbe7fff700] [channel-bootstrap] - id=0x4dc8910: channel 0x7efbe0005320 setup failed with error 1029.
[ERROR] [2020-03-30T18:38:27Z] [00007efbe7fff700] [Unknown] - static: Client connection failed with error 1029 (AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE).
[ERROR] [2020-03-30T18:38:27Z] [00007efbe7fff700] [Unknown] - id=0x4e351c0: Websocket setup failed to establish HTTP connection, error 1029 (AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE).
N-API call failed: napi_call_function(env, this_ptr, function, argc, argv, NULL)
@ /root/aws-crt-nodejs/source/module.c:376: napi_pending_exception
Calling (error_code, return_code, session_present) => {
if (error_code == 0 && return_code == 0) {
resolve(session_present);
this.emit('connect', session_present);
}
else if (error_code != 0) {
reject("Failed to connect: " + io.error_code_to_string(error_code));
}
else {
reject("Server rejected connection.");
}
}
Error: Failed to connect: aws-c-io: AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE, TLS (SSL) negotiation failed
Stack:
Error: Failed to connect: aws-c-io: AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE, TLS (SSL) negotiation failed
at /home/batja/Projects/xpresshd/project-a/public-api/node_modules/aws-crt/lib/native/mqtt.ts:288:32
at on_connect (/home/batja/Projects/xpresshd/project-a/public-api/node_modules/aws-crt/lib/native/mqtt.ts:140:21)
N-API call failed: aws_napi_dispatch_threadsafe_function(env, args->on_connect, NULL, on_connect, num_params, params)
@ /root/aws-crt-nodejs/source/mqtt_client_connection.c:299: napi_pending_exception
Fatal error condition occurred in /root/aws-crt-nodejs/source/mqtt_client_connection.c:299: aws_napi_dispatch_threadsafe_function(env, args->on_connect, NULL, on_connect, num_params, params)
Exiting Application
################################################################################
Resolved stacktrace:
################################################################################
0x00007efbfc48ba0b: ?? ??:0
0x00007efbfc483233: ?? ??:0
0x00000000000d2c95: s_on_connect_call at mqtt_client_connection.c:?
0x00000000009880a5: _ZN6v8impl12_GLOBAL__N_118ThreadSafeFunction6IdleCbEP9uv_idle_s at node_api.cc:?
0x000000000127517c: uv__run_idle at loop-watcher.c:68 (discriminator 4)
0x000000000126de18: uv_run at core.c:362
0x00000000009f13dc: _ZN4node16NodeMainInstance3RunEv at ??:?
0x0000000000986911: _ZN4node5StartEiPPc at ??:?
0x00007efbff16a023: ?? ??:0
0x0000000000924865: _start at ??:?
################################################################################
Raw stacktrace:
################################################################################
/home/batja/Projects/xpresshd/project-a/public-api/node_modules/aws-crt/dist/bin/linux-x64/aws-crt-nodejs.node(aws_backtrace_print+0x4b) [0x7efbfc48ba0b]
/home/batja/Projects/xpresshd/project-a/public-api/node_modules/aws-crt/dist/bin/linux-x64/aws-crt-nodejs.node(aws_fatal_assert+0x43) [0x7efbfc483233]
/home/batja/Projects/xpresshd/project-a/public-api/node_modules/aws-crt/dist/bin/linux-x64/aws-crt-nodejs.node(+0xd2c95) [0x7efbfc3fcc95]
/home/batja/.nvm/versions/node/v12.6.0/bin/node() [0x9880a5]
/home/batja/.nvm/versions/node/v12.6.0/bin/node() [0x127517c]
/home/batja/.nvm/versions/node/v12.6.0/bin/node(uv_run+0x368) [0x126de18]
/home/batja/.nvm/versions/node/v12.6.0/bin/node(_ZN4node16NodeMainInstance3RunEv+0x2ec) [0x9f13dc]
/home/batja/.nvm/versions/node/v12.6.0/bin/node(_ZN4node5StartEiPPc+0x291) [0x986911]
/usr/lib/libc.so.6(__libc_start_main+0xf3) [0x7efbff16a023]
/home/batja/.nvm/versions/node/v12.6.0/bin/node() [0x924865]
Signal received: 0, errno: 0
################################################################################
Resolved stacktrace:
################################################################################
0x00007efbfc48ba0b: ?? ??:0
0x00000000000d0d83: s_print_stack_trace at module.c:?
0x0000000000014800: __restore_rt at sigaction.c:?
0x00007efbff17ece5: ?? ??:0
0x00007efbff168857: ?? ??:0
0x0000000000159238: aws_fatal_assert at ??:?
0x00000000000d2c95: s_on_connect_call at mqtt_client_connection.c:?
0x00000000009880a5: _ZN6v8impl12_GLOBAL__N_118ThreadSafeFunction6IdleCbEP9uv_idle_s at node_api.cc:?
0x000000000127517c: uv__run_idle at loop-watcher.c:68 (discriminator 4)
0x000000000126de18: uv_run at core.c:362
0x00000000009f13dc: _ZN4node16NodeMainInstance3RunEv at ??:?
0x0000000000986911: _ZN4node5StartEiPPc at ??:?
0x00007efbff16a023: ?? ??:0
0x0000000000924865: _start at ??:?
################################################################################
Raw stacktrace:
################################################################################
/home/batja/Projects/xpresshd/project-a/public-api/node_modules/aws-crt/dist/bin/linux-x64/aws-crt-nodejs.node(aws_backtrace_print+0x4b) [0x7efbfc48ba0b]
/home/batja/Projects/xpresshd/project-a/public-api/node_modules/aws-crt/dist/bin/linux-x64/aws-crt-nodejs.node(+0xd0d83) [0x7efbfc3fad83]
/usr/lib/libpthread.so.0(+0x14800) [0x7efbff31f800]
/usr/lib/libc.so.6(gsignal+0x145) [0x7efbff17ece5]
/usr/lib/libc.so.6(abort+0x12b) [0x7efbff168857]
/home/batja/Projects/xpresshd/project-a/public-api/node_modules/aws-crt/dist/bin/linux-x64/aws-crt-nodejs.node(+0x159238) [0x7efbfc483238]
/home/batja/Projects/xpresshd/project-a/public-api/node_modules/aws-crt/dist/bin/linux-x64/aws-crt-nodejs.node(+0xd2c95) [0x7efbfc3fcc95]
/home/batja/.nvm/versions/node/v12.6.0/bin/node() [0x9880a5]
/home/batja/.nvm/versions/node/v12.6.0/bin/node() [0x127517c]
/home/batja/.nvm/versions/node/v12.6.0/bin/node(uv_run+0x368) [0x126de18]
/home/batja/.nvm/versions/node/v12.6.0/bin/node(_ZN4node16NodeMainInstance3RunEv+0x2ec) [0x9f13dc]
/home/batja/.nvm/versions/node/v12.6.0/bin/node(_ZN4node5StartEiPPc+0x291) [0x986911]
/usr/lib/libc.so.6(__libc_start_main+0xf3) [0x7efbff16a023]
/home/batja/.nvm/versions/node/v12.6.0/bin/node() [0x924865]
const level : io.LogLevel = parseInt(io.LogLevel[argv.verbosity.toUpperCase()]);
io.enable_logging(level);
Additional context Add any other context about the problem here.
Using node v12.6.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:27 (8 by maintainers)
Top Results From Across the Web
WebSocket connection to 'ws://localhost:9090/' failed: Error in ...
Chrome doesn't allow unsecure websocket (ws) connections to localhost (only wss, so you should setup a TLS certificate for your local web/websocket server)....
Read more >Error with WebSocket - Microsoft Q&A
Hello I get the error: WebSocket connection to 'wss://localhost:54970/Dashboard.Server/' failed: Error in connection establishment: net:: ...
Read more >How to resolve the error: "Could not open websocket connection
For the AWS ELB's Classic Load Balancer: The problem will be due to Classic Load Balancer's HTTP protocol not passing along WebSocket requests....
Read more >Troubleshooting connection issues | Socket.IO
Problem : the socket is not able to connect. Possible explanations: You are trying to reach a plain WebSocket server; The server is...
Read more >How do I troubleshoot WebSocket issues in Agents (All ...
forgerock.openam.agents.notifications.websocket.WebSocketConnectionException: Failed to create connection; If you are using Apache™ HTTP Server ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@reinismu I just stopped using the v2 SDK 👎 and went back to the way easier to use and definitely working v1 SDK 👍
Any updates?
I tried again with newer versions. I noticed if I put constant
client_idand run it twice (first time still wouldn’t work) it will work the second time.Code
First time output
Second time output and it seems to be working
In any case I want to use random
uuid()for client ID’s and need just the pub sub functionality out of IoT.