Error writing to local Blob storage using azure-storage-blob 12.6
See original GitHub issue- Package Name: azure-storage-blob
- Package Version: 12.6
- Operating System: Raspbian GNU/Linux 10 (buster)
- Python Version: 3.7.3
Describe the bug
Get ErrorCode:InvalidHeaderValue when attempting to write to local storage using version 12.6. Version 2.1 appears to work correctly.
To Reproduce Using code sample from this project:
import os
from azure.storage.blob import BlobClient
BLOB_CONNECTION_STRING = 'DefaultEndpointsProtocol=http;AccountName=<account name>;AccountKey=<account key>;BlobEndpoint=http://127.0.0.1:11002/<account name>;'
container = 'iot-timing-upload'
blob_file_name = 'anon.txt'
full_path='/home/pi/anon.txt'
blob = BlobClient.from_connection_string(conn_str=BLOB_CONNECTION_STRING, container_name=container, blob_name=blob_file_name)
with open(full_path, "rb") as data:
blob.upload_blob(data)
Error:
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 "testblob12.6.py", line 13, 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 158, 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:fc81ad90-1e8d-4574-8a2e-95b4c9e5e158
Time:2020-12-31T12:27:13.0600996Z
ErrorCode:InvalidHeaderValue
Error:None
HeaderName:x-ms-version
HeaderValue:2020-02-10
ExceptionDetails:None
ExceptionMessage:The value 2020-02-10 provided for request header x-ms-version is invalid.
StackTrace:Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.InvalidHeaderProtocolException: The value 2020-02-10 provided for request header x-ms-version is invalid.
at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer`1.RunVersionCheck() in F:\Storage-XStore\src\XFE\common\Protocols\REST\src\BasicHttpProcessorWithAuthAndAccountContainerBase.cs:line 788
at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer`1.ProcessImpl(AsyncIteratorContext`1 async)+MoveNext() in F:\Storage-XStore\src\XFE\common\Protocols\REST\src\BasicHttpProcessorWithAuthAndAccountContainerBase.cs:line 1537
Expected behavior Upload file to blob
Additional context Works correctly using same connection string with azure-storage-blob 2.1.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Solve timeout errors on file uploads with new azure.storage ...
upload() fails on larger files with a timeout error that completely ignores the timeout parameter of the function. I get a ServiceResponseError ...
Read more >IoTEdge local blob storage not accessible - Microsoft Q&A
3) I am trying to write to the local storage however and it doesn't appear to work. Firstly, using the Azure storage 2.1.0...
Read more >Azure Storage Blobs client library for Python - NET
Storage Blob clients raise exceptions defined in Azure Core. All Blob service operations will throw a StorageErrorException on failure with helpful error codes....
Read more >azure-storage-blob - PyPI
Azure Storage Blobs client library for Python. Azure Blob storage is Microsoft's object storage solution for the cloud. Blob storage is optimized for...
Read more >@azure/storage-blob - npm
Microsoft Azure Storage SDK for JavaScript - Blob. Latest version: 12.12.0, last published: 2 months ago. Start using @azure/storage-blob in ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @cclague
There is an workaround: set api_version=“2019-12-12” when initiating BlobClient eg. BlobClient.from_connection_string(your_con_str, your_container_name, your_blob_name, api_version=“2019-12-12”)
we have customers reporting the similar issue before, and we reached out to another team for help https://github.com/MicrosoftDocs/azure-docs/issues/65265 let me check if there’s any updates
Hi - version 1.4.0 of “Azure Blob Storage on IoT Edge” module works - thank you!