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

Cannot deserialize response data which contains values of type None #544

Closed
tjprescott opened this issue Mar 15, 2016 · 6 comments
Closed

Comments

@tjprescott
Copy link
Member

When trying to show a resource:

resource_client.resources.get(
            resource_group_name=<group_name>
            resource_name=<name>,
            resource_provider_namespace=<namespace>,
            resource_type=<type>,
            api_version=<api_version>,
            parent_resource_path=<path> or ''
        )

I get an msrest DeserializationError:

Unable to deserialize response data. Data: {...}, object, TypeError: Cannot deserialize generic object with type: <class 'NoneType'>

The response data contains the information I want although numerous fields have None as their value.

@lmazuel
Copy link
Member

lmazuel commented Mar 15, 2016

I'm not able to reproduce your problem. If you were able to get the JSON answer, could you add it in this issue?
Thank you

@tjprescott
Copy link
Member Author

This is the exception message with the data:

Unable to deserialize response data. Data: {'siteMode': None, 'resourceGroup': 'FooResourceGroup', 'perSiteScaling': False, 'geoRegion': 'West US', 'currentWorkerSize': 0, 'hostingEnvironmentProfile': None, 'webSpace': 'FooWebspace', 'planName': 'VirtualDedicatedPlan', 'workerSizeId': 0, 'workerSize': 0, 'serverFarmId': 0, 'maximumNumberOfWorkers': 1, 'workerTierName': None, 'subscription': 'FooSubscriptionId', 'numberOfSites': 0, 'hostingEnvironmentId': None, 'adminSiteName': None, 'adminRuntimeSiteName': None, 'tags': None, 'computeMode': 0, 'kind': None, 'numberOfWorkers': 0, 'name': 'FooResourceName', 'currentNumberOfWorkers': 0, 'status': 0, 'hostingEnvironment': None, 'currentWorkerSizeId': 0}, object, TypeError: Cannot deserialize generic object with type: <class 'NoneType'>

And here's the call stack upstream of our code

File "C:\Users\t\Documents\github\azure-cli\env\lib\site-packages\azure\mgmt\resource\resources\operations\resources_operations.py", line 462, in get
deserialized = self._deserialize('GenericResource', response)
File "C:\Users\t\Documents\github\azure-cli\env\lib\site-packages\msrest\serialization.py", line 623, in call
value = self.deserialize_data(raw_value, attr_type)
File "C:\Users\t\Documents\github\azure-cli\env\lib\site-packages\msrest\serialization.py", line 736, in deserialize_data
raise_with_traceback(DeserializationError, msg, err)
File "C:\Users\t\Documents\github\azure-cli\env\lib\site-packages\msrest\exceptions.py", line 47, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "C:\Users\t\Documents\github\azure-cli\env\lib\site-packages\msrest\serialization.py", line 722, in deserialize_data
data_val = self.deserialize_typedata_type
File "C:\Users\t\Documents\github\azure-cli\env\lib\site-packages\msrest\serialization.py", line 784, in deserialize_object
value, **kwargs)
File "C:\Users\t\Documents\github\azure-cli\env\lib\site-packages\msrest\serialization.py", line 801, in deserialize_object
raise TypeError(error + str(obj_type))

@tjprescott
Copy link
Member Author

So, when I use the SDK method to retrieve a storage account, it worked fine. The above issue occurred when I tried to retrieve a server farm resource.

@lmazuel
Copy link
Member

lmazuel commented Mar 16, 2016

I think you fall into this known bug Azure/azure-rest-api-specs#137
However, I didn't open that bug with the exact same code as you (I used the mgmt-web API directly)
I will try asap to confirm this is the same bug.

@lmazuel
Copy link
Member

lmazuel commented Mar 18, 2016

I was wrong, it was not related. I just created a PR to the underlying runtime library for fix.

@lmazuel
Copy link
Member

lmazuel commented Mar 21, 2016

Hi,

I just released msrest 0.1.3 which fixes this bug
https://pypi.python.org/pypi/msrest/0.1.3

Thank you for your report again!

@lmazuel lmazuel closed this as completed Mar 21, 2016
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants