Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration Error between azure-blob-storage container and Python Client #35577

Closed
AlanTuring1988 opened this issue May 10, 2024 · 7 comments
Closed
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)

Comments

@AlanTuring1988
Copy link

I'm trying to integrate a python script with the mcr.microsoft.com/azure-blob-storage:latest docker module.

I get the same error both when I invoke both the container_client.exists() and container_client.create_container() methods

The sdk Python version used is azure-storage-blob==12.19.1

Error:

`

  Response status: 400
  Response headers:
      'x-ms-request-id': '87a60859-cb94-4596-8d26-0b8320e77bee'
      'Content-Type': 'application/xml'
      'Server': 'Microsoft-NetCore/2.0'
      'Date': 'Fri, 10 May 2024 14:44:41 GMT'
      'Content-Length': '940'
      'Connection': 'close'
  Response content:
  Exception:
  The value for one of the HTTP headers is not in the correct format.
  RequestId:87a60859-cb94-4596-8d26-0b8320e77bee
  Time:2024-05-10T14:44:41.7156917Z
  ErrorCode:InvalidHeaderValue
  headername:x-ms-version
  headervalue:2023-11-03
  exceptiondetails:None
  Content: <?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:87a60859-cb94-4596-8d26-0b8320e77bee
  Time:2024-05-10T14:44:41.7156917Z</Message><HeaderName>x-ms-version</HeaderName><HeaderValue>2023-11-03</HeaderValue><ExceptionDetails><ExceptionMessage>The value 2023-11-03 provided for request header x-ms-version is invalid.</ExceptionMessage><StackTrace>Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.InvalidHeaderProtocolException: The value 2023-11-03 provided for request header x-ms-version is invalid.
     at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer`1.RunVersionCheck()
     at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer`1.ProcessImpl(AsyncIteratorContext`1 async)+MoveNext()</StackTrace></ExceptionDetails></Error>

`

Code:
`

connection_string = f"DefaultEndpointsProtocol=http;BlobEndpoint=http://{params.localBlobStorageName}:11002/{params.accountName};AccountName={params.accountName};AccountKey={params.accountKey}";

logger = logging.getLogger('azure.storage.blob')
logger.setLevel(logging.DEBUG)

handler = logging.StreamHandler(stream=sys.stdout)
logger.addHandler(handler)
try:
    service = BlobServiceClient.from_connection_string(connection_string,logging_enable=True)

    container_name = "my_container_name"

    container_client = service.get_container_client(container=container_name)

    if not container_client.exists():
            container_client.create_container()

except Exception as ex:
    print('Exception:')
    print(ex)

`

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files) labels May 10, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jalauzon-msft @vincenttran-msft.

@AlanTuring1988
Copy link
Author

I tried with version 12.5.0 of the python sdk and the problem not exist. in fact I uploaded the blob locally and then check it on the cloud.

@swathipil
Copy link
Member

Hi @AlanTuring1988 - thanks for opening an issue. We'll take a look asap!

@jalauzon-msft
Copy link
Member

Hi @AlanTuring1988, the main reason for the behavior you are seeing is that that Docker image does not stay up to date with the Storage service in terms of API versions. In fact, it looks like it has not been updated in some time. That page says the last API version they added support for was 2020-04-08 which is quite old. I'm not sure if this image is deprecated or what is going on there. Perhaps they have added support for newer ones without specifying.

With each minor release of the SDK, we update the default API version that is used to the latest supported by the live Azure Storage service. For 12.19.1 that is 2023-11-03 which is what you are seeing in the error message. As mentioned, it seems that image may only support up to 2020-04-08.

So, you have two options:

  • You can downgrade your SDK version, like you have done (I am not quite sure what is the latest version you can use as we did not used to write the API version in the CHANGELOG but it seems like it will have to be before 12.9.0 at least).
  • You can try using the latest SDK but manually setting the API version in the client constructor using the api_version keyword. Anything in this list is valid but you may want to start with 2020-04-08 and work your way up.
    • There is a chance, depending on what operations and auth type you are using, that this does not work as changes in the SDK are not always backwards compatible with older API versions.

You can also try submitting feedback for that image here to see if there are plans to update it further or whether there is a replacement. (The SDK team is not familiar with it at all.)

@xiangyan99 xiangyan99 added the issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. label May 13, 2024
@github-actions github-actions bot removed the needs-team-attention This issue needs attention from Azure service team or SDK team label May 13, 2024
Copy link

Hi @AlanTuring1988. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

Copy link

Hi @AlanTuring1988, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

@AlanTuring1988
Copy link
Author

AlanTuring1988 commented May 21, 2024

Hi, I resolved using 12.5.0 version of the python module and with mcr.microsoft.com/azure-blob-storage::1.4.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

5 participants