I got similar error, and Tasmota could never connect to AWS.
Everybody was referring to this page: https://github.com/arendst/Sonoff-Tasmota/wiki/AWS-IoT
But there is no such page. The URL had moved to its new location:
https://tasmota.github.io/docs/AWS-IoT/
Finally I found that the CloudFormation yaml was incomplete.
The AWS console generated TasmotaAuth/Outputs/BackLogCommand was:
BackLog MqttHost xxxxx-ats.iot.us-east-2.amazonaws.com; MqttPort 443; MqttUser tasmota?x-amz-customauthorizer-name=TasmotaAuth; MqttPassword xxxxxxx
It should have included the following to additional options:
SetOption3 1; SetOption103 1;
Probably these were there in an earlier version, but are now missing, as of August 2021.
SetOption103 defaults to false
, so my TLS was disabled:
#define MQTT_TLS_ENABLED false // [SetOption103] Enable TLS mode (requires TLS version)
When I manually issued the command
SetOption103 1
on the Tasmota web console, messages started flowing to AWS.
Either the CloudFormation script need to be changed, or the documentation should be corrected as follows:
Add the following to user_config_override.h:
#ifndef USE_MQTT_TLS
#define USE_MQTT_TLS
#define USE_MQTT_TLS_CA_CERT // Optional but highly recommended
#endif
#ifndef USE_MQTT_AWS_IOT_LIGHT
#define USE_MQTT_AWS_IOT_LIGHT
#endif
#ifdef USE_DISCOVERY
#undef USE_DISCOVERY
#endif
#undef MQTT_TLS_ENABLED
#define MQTT_TLS_ENABLED true