Uploaded files to azure blob storage are empty or not even present
I run into this a lot. My best guess something has a lock on the file. I team into this with a logic app that scanned a SharePoint directory every five minutes. It would grab an Excel file and move it to blob storage. But I kept getting 0k files. I haven't seen this issue since changing the logic app too check every ten minutes. This increases the odds that a user will not be in the file.
I can upload files to Azure, but sometimes the files I send to Azure are empty or not even present. I use iothub_client (from azure-iothub-device-client).
First I create a series of csv and json files from an SQL database which I temporarily store on my pc. These files are then processed by the upload client and uploaded asynchronously to a storage blob.
Basically the structure is:
-- ID
---- csv file
---- csv file
---- json file
Most of the time this functions without any problems, however sometimes something doesn't work correctly and one csv file is containing only the header row - but never all of them - and/or the json file is even missing. The order of uploading is:

csv file one
json file
csv file two

The files are however always correctly created and stored on my pc. The code does not give any errors, so the iothub_client seems to be happy with what it's getting as input.
I can't figure out why this goes wrong, as I have not been able to reproduce the error. Retrying to upload the same files results in a correctly executed upload procedure.
Any clues about what can be the cause would be very much appreciated!