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

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.

About this issue

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

Commits related to this issue

Most upvoted comments

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

@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?