question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upload to IoT Edge Blob Storage: ExceptionMessage:The value 2019-12-12 provided for request header x-ms-version is invalid.

See original GitHub issue

Describe the bug I’m trying to use Azure Python SDK to upload a file from a Raspberry Pi Zero to another IoT device running Azure IoT Edge Blob Storage module. I’m able to interact with the module by uploading/downloading files via Storage Explorer so I believe that is working as expected. However, I’m unable to use Azure SDK for Python to upload file to Blob storage service running on IoT Edge.

Error I’m seeing is: Traceback (most recent call last): File “/home/pi/.local/lib/python3.7/site-packages/azure/storage/blob/_upload_helpers.py”, line 106, in upload_block_blob **kwargs) File “/home/pi/.local/lib/python3.7/site-packages/azure/storage/blob/_generated/operations/_block_blob_operations.py”, line 222, in upload raise models.StorageErrorException(response, self._deserialize) azure.storage.blob._generated.models._models_py3.StorageErrorException: Operation returned an invalid status ‘The value for one of the HTTP headers is not in the correct format.’

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “localblob.py”, line 15, in <module> blob.upload_blob(data) File “/home/pi/.local/lib/python3.7/site-packages/azure/core/tracing/decorator.py”, line 83, in wrapper_use_tracer return func(*args, **kwargs) File “/home/pi/.local/lib/python3.7/site-packages/azure/storage/blob/_blob_client.py”, line 539, in upload_blob return upload_block_blob(**options) File “/home/pi/.local/lib/python3.7/site-packages/azure/storage/blob/_upload_helpers.py”, line 156, in upload_block_blob process_storage_error(error) File “/home/pi/.local/lib/python3.7/site-packages/azure/storage/blob/_shared/response_handlers.py”, line 147, in process_storage_error raise error azure.core.exceptions.HttpResponseError: The value for one of the HTTP headers is not in the correct format. RequestId:b0deb939-b93e-4d5a-a075-2ed4a22ec3aa Time:2020-09-23T14:25:22.8346188Z ErrorCode:InvalidHeaderValue Error:None HeaderName:x-ms-version HeaderValue:2019-12-12 ExceptionDetails:None ExceptionMessage:The value 2019-12-12 provided for request header x-ms-version is invalid. StackTrace:Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.InvalidHeaderProtocolException: The value 2019-12-12 provided for request header x-ms-version is invalid. at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer1.RunVersionCheck() in F:\Storage-XStore\src\XFE\common\Protocols\REST\src\BasicHttpProcessorWithAuthAndAccountContainerBase.cs:line 788 at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer1.ProcessImpl(AsyncIteratorContext`1 async)+MoveNext() in F:\Storage-XStore\src\XFE\common\Protocols\REST\src\BasicHttpProcessorWithAuthAndAccountContainerBase.cs:line 1537

To Reproduce Steps to reproduce the behavior:

  1. Create IoT Edge device (I’m using a Raspberry PI 3 running Raspbian Buster for this) running Azure Blob Storage on IoT Edge (https://docs.microsoft.com/en-us/azure/iot-edge/how-to-store-data-blob)

  2. On another local-network device use Azure SDK for Python (I’m using Raspberry Pi Zero W for this) to connect to the Blob service running on the IoT Edge device.

  3. This is the python code I’m using (Python 3.7.3 running on Pi Zero) to connect to the IoT Edge Blob Service:

    import os, uuid from azure.storage.blob import BlobClient

    Connection string to the local Blob service

    connection_string = “DefaultEndpointsProtocol=http;BlobEndpoint=http://192.168.0.12:11002/localblob;AccountName=localblob;AccountKey=[KEY]

    local_path = “./” local_file_name = “pizerocam.txt” upload_file_path = os.path.join(local_path, local_file_name) localcontainer = “pisynccontainer”

    blob = BlobClient.from_connection_string(conn_str=connection_string, container_name=localcontainer, blob_name=local_file_name)

    with open(upload_file_path, “rb”) as data: blob.upload_blob(data)

Expected behavior I expect the file pizerocam.txt to be uploaded to the blob container on the Blob Service running on IoT Edge

Screenshots https://gamgee.blob.core.windows.net/public/localBlobPythonError.png

Additional context I have verified that the local Blob service is working as I’ve connected to it with the exact same connection string using Azure Storage Explorer. I’m just having an issue getting the Python SDK to connect using this same connection string.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
keecmcommented, Sep 28, 2020

i was having the same error with python. Added api_version=‘2019-07-07’ to BlobServiceClient solved the problem.

1reaction
maeckycommented, Sep 27, 2020

@xiafu-msft is this python package a different version than the one from pypi: https://pypi.org/project/azure-storage-blob/#history

If so, could you please update the pypi version?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Store block blobs on devices - Azure IoT Edge - Microsoft Learn
This function automatically uploads the data from your local blob storage to Azure with intermittent internet connectivity support. It allows ...
Read more >
Azure storage REST Api call - Invalid Header x-ms-version
HTTP/1.1 400 The value for one of the HTTP headers is not in the correct format. The xml body has more details: <Error>...
Read more >
IOT Edge File Storage - Gordon Byers - Azure
This post is all about implementing Storage on you IoT edge device. ... 2020-02-10 provided for request header x-ms-version is invalid.
Read more >
Azure Blob Storage by Microsoft | Docker Hub
Featured Tags. docker pull mcr.microsoft.com/azure-blob-storage. About this Image. Azure Blob Storage on IoT Edge provides block and append blob storage ...
Read more >
Collecting Large Datasets from Industrial Assets - Codit
Through Azure IoT Edge, you can collect a large amount of data from ... Local storing: Storing the data in local Blob storage...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found