By chance are you using the aws-iot-device-sdk-python library? And then also sending the shadow update message in the same thread that receives a IoT topic (including receiving other shadow updates)? For reasons I have never fully understood, sending a IoT message in the callback thread (after receiving a message on a subscription) will throw a publish timeout error. If this is the case there are a couple of things you can do to try and resolve the problem.
- Spin up a worker thread to publish your shadow changes.
- Migrate your code to the newer [aws-iot-device-sdk-python-v2 library] (https://github.com/aws/aws-iot-device-sdk-python-v2).
A couple of further general suggestions to try and help narrow down the causes.
- Since publishing to IoT Shadows are really just publishing messages to special IoT topics, test whether or not you can consistently publish to a non-shadow topic. This will tell you if it's a problem with the shadow service or a general problem with IoT publishing.
- Make sure you are publishing with QoS 1, which sends back receive receipts.
- Set your code up such that if you get a publish timeout do a ping to your IoT endpoint. If the ping times out, this would tell you the problem is general networking versus IoT.
There was an update to the sdk in december 2021 which fixed the issue for me. Currently (Jan. 2022) you need to install it manually from github to use it.
Greengrass Connectivity and Missed Shadow Updatesasked a year ago
How to deal with shadow updates initated by device not and serverasked 10 months ago
AWS IOT v2 SDK migration from v1 sdkasked 4 months ago
Usage of named shadowasked 2 months ago
Timeouts using aws-iot-device-sdk-pythonAccepted Answerasked a year ago
GreengrassV2-Core's IoT-Thing-shadow never beeing synchronized with remoteasked 4 months ago
Greengrass v2 interact with shadows from a nodejs lambdaAccepted Answerasked 5 months ago
Roadmap for Greengrass v2 feature parity with v1?asked 2 years ago
IoT thing shadow and Greengrass componentasked 2 years ago
Greengrass V2 Shadow + MQTT (Moquette)Accepted Answerasked 3 months ago