Azure / azure-storage-python

Microsoft Azure Storage Library for Python
https://azure-storage.readthedocs.io
MIT License
338 stars 240 forks source link

X-MS-VERSION header incorrect value #631

Closed konradsitarz closed 4 years ago

konradsitarz commented 4 years ago

I use azure-storage-blob to send file to blob storage.

SDK versions:

azure-common==1.1.23
azure-storage-blob==2.1.0
azure-storage-common==2.1.0

When I try to send file I got error that the value of the X-MS-VERSION header has wrong value.

Exception=The value for one of the HTTP headers is not in the correct format. ErrorCode: InvalidHeaderValue<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidHeaderValue</Code><Message>The value for one of the HTTP headers is not in the correct format.RequestId:c0e6b190-201e-0062-4390-59222d000000Time:2019-08-23T08:57:32.0999355Z</Message><HeaderName>x-ms-version</HeaderName><HeaderValue>2019-02-02</HeaderValue></Error>.

What should be the value of the header and how to change it to be able to use it in code?

I managed to change the value manually inside the azure/storage/blob/_constants.py X_MS_VERSION but I don't know what should be working value.

UPDATE: I replaced the X_MS_VERSION= '2019-02-02' with previous version I know about versions from here. X_MS_VERSION = '2018-11-09'

and it worked.

HACK SOLUTION While creating blobService i replace the _X_MS_VERSION parameter with working one. It's not much of a clear hack but it works.

blobService = BlockBlobService(connection_string=connection_string)

blobService._X_MS_VERSION = '2018-11-09'
zezha-msft commented 4 years ago

Hi @konradsitarz, thanks for reaching out!

You are not using public Azure, right? The latest service version may not be deployed in your platform.

zezha-msft commented 4 years ago

@konradsitarz it appears that this might be a configuration problem. My colleagues are working on resolving it. I'll update this thread shortly.

zezha-msft commented 4 years ago

@konradsitarz it's fixed! Please let us know if you have any other issue.

SSUS31 commented 3 years ago

Facing same issue

zezha-msft commented 3 years ago

@SSUS31 please try the latest SDK version 12. Thanks!