Azure / azure-storage-python

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

Failed to create a table in Azure Stack environment because of "azure.common.AzureHttpError: JSON format is not supported" #104

Closed bingosummer closed 8 years ago

bingosummer commented 8 years ago

Hi,

I tried to create a container and table in Azure Stack environment. And creating the container succeeded, but creating the table failed.

This is the script:

from azure.storage.blob import BlobService
from azure.storage.table import TableService

storage_account_name = "xxx"
storage_access_key = "xxx"
service_host_base = "azurestack.local"
blob_service = BlobService(
    account_name=storage_account_name,
    account_key=storage_access_key,
    host_base='.blob.{0}'.format(service_host_base)
)
blob_service.create_container('foo1')

table_service = TableService(
    account_name=storage_account_name,
    account_key=storage_access_key,
    host_base='.table.{0}'.format(service_host_base)
)
table_service.create_table('bar1')

This is the error:

Traceback (most recent call last):
  File "test_setup_devbox.py", line 37, in <module>
    table_service.create_table('bar1')
  File "/usr/local/lib/python2.7/dist-packages/azure/storage/table/tableservice.py", line 281, in create_table
    _dont_fail_on_exist(ex)
  File "/usr/local/lib/python2.7/dist-packages/azure/storage/_common_error.py", line 65, in _dont_fail_on_exist
    raise error
azure.common.AzureHttpError: JSON format is not supported.
<?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code>JsonFormatNotSupported</m:code><m:message xml:lang="en-US">JSON format is not supported.
RequestId:4e4069c0-20fa-45fa-b328-9facf35d03c1
Time:2016-02-02T02:21:49.7169355Z</m:message><m:innererror><m:message>JSON format is not supported.</m:message><m:type>Microsoft.Cis.Services.Nephos.Table.Service.Protocols.Rest.TableServiceProtocolException</m:type><m:stacktrace>   at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer`1.EndPerformOperation(IAsyncResult ar)&#xD;
   at Microsoft.Cis.Services.Nephos.Common.Protocols.Rest.BasicHttpProcessorWithAuthAndAccountContainer`1.&lt;ProcessImpl&gt;d__4.MoveNext()</m:stacktrace><m:internalexception><m:message>JSON format is not supported.</m:message><m:type>Microsoft.Cis.Services.Nephos.Table.Service.Protocols.Rest.TableServiceProtocolException</m:type><m:stacktrace>   at Microsoft.ObjectStorage.FrontEnd.Odl.TableProvider.ODataTableManager.EndPerformOperation(IAsyncResult ar)&#xD;
   at Microsoft.Cis.Services.Nephos.Table.Service.Protocols.Rest.TableProtocolHead.&lt;TableAndRowOperationImpl&gt;d__0.MoveNext()&#xD;
   at AsyncHelper.AsyncIteratorContextBase.ExecuteIterator(Boolean inBegin)</m:stacktrace><m:internalexception><m:message>JSON format is not supported.</m:message><m:type>Microsoft.Cis.Services.Nephos.Table.Service.Protocols.Rest.TableServiceProtocolException</m:type><m:stacktrace>   at Microsoft.ObjectStorage.FrontEnd.Odl.TableProvider.ODataMediaTypeUtils.ParseAcceptHeader(String acceptHeader, String formatOption, ODataVersion serviceVersion, String&amp; supportedMediaType, ODataFormat&amp; supportedFormat)&#xD;
   at Microsoft.ObjectStorage.FrontEnd.Odl.TableProvider.Handlers.RequestHandler.Init()&#xD;
   at Microsoft.ObjectStorage.FrontEnd.Odl.TableProvider.Handlers.RequestHandler..ctor(IODataRequestMessage requestMessage, IODataResponseMessage responseMessage)&#xD;
   at Microsoft.ObjectStorage.FrontEnd.Odl.TableProvider.Handlers.RootRequestHandler..ctor(IODataRequestMessage requestMessage, IODataResponseMessage responseMessage, ITableClient tableClient)&#xD;
   at Microsoft.ObjectStorage.FrontEnd.Odl.TableProvider.ODataTableManager.BeginOdlProcess(IAccountIdentifier identifier, TableProtocolHead tableProtocolHead, RequestStartedCallback requestStartedCallback, CheckPermissionDelegate checkPermissionCallback, QueryRowCommandPropertiesAvailableCallback queryRowCommandPropertiesAvailableCallback, Dictionary`2 continuationToken, ContinuationTokenAvailableCallback continuationTokenAvailableCallback, Boolean operationIsConditional, AsyncCallback callback, Object state)&#xD;
   at Microsoft.ObjectStorage.FrontEnd.Odl.TableProvider.ODataTableManager.&lt;PerformOperationImpl&gt;d__0.MoveNext()&#xD;
   at AsyncHelper.AsyncIteratorContextBase.ExecuteIterator(Boolean inBegin)</m:stacktrace></m:internalexception></m:internalexception></m:innererror></m:error>

Thanks

emgerner-msft commented 8 years ago

This is an odd error. What version of the storage library are you using?

If possible, could you provide a network trace showing the HTTP request which was sent? On Windows Fiddler is a good tool for this, but there's lots available.

jehine-MSFT commented 8 years ago

It appears that this is an Azure Stack issue this is being looked at internally. Thanks for bringing this to our attention!

emgerner-msft commented 8 years ago

Closing as this is being taken up with Azure Stack team and this is not a storage library issue.