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

Exception when calling WebApps.ListAsync in Azure Function #191

Closed
bjornsallarp opened this issue Mar 1, 2018 · 8 comments
Closed

Exception when calling WebApps.ListAsync in Azure Function #191

bjornsallarp opened this issue Mar 1, 2018 · 8 comments
Assignees

Comments

@bjornsallarp
Copy link

I have a class library project in my solution that call the following method
var webApps = await azure.WebApps.ListAsync();
Target is .NET 4.7 and I use Newtonsoft 11.0.1

When I run the code from a Console App in the same solution, it works fine. When I run it from my Azure Function (.NET 4.7 target, Newtonsoft 11.0.1) project it throws an exception. This is the output in my Function window:

mscorlib: Exception while executing function: ExtractApps. Microsoft.Azure.Management.AppService.Fluent: Unable to deserialize the response. Newtonsoft.Json: Error reading JObject from JsonReader. Current JsonReader item is not an object: Null. Path 'properties.snapshotInfo', line 1, position 2727.

@hovsepm
Copy link
Contributor

hovsepm commented Mar 1, 2018

@bjornsallarp could you post here server response?

@bjornsallarp
Copy link
Author

I prefer not posting the response here as it could disclose sensitive contractor information. I did set up a small sample that reproduce the problem here https://github.com/bjornsallarp/AzureFluentInFunctionException

Please let me know if I can provide you with the response in a private way. I could also provide you with our tennantid, clientid and a secret if it doesn't reproduce with other subscriptions.

@hovsepm
Copy link
Contributor

hovsepm commented Mar 1, 2018

@bjornsallarp thanks for the repro. could you send the payload directly to me?

@hovsepm
Copy link
Contributor

hovsepm commented Apr 16, 2018

@bjornsallarp thank you for finding the root cause. The issue exists only in V1 of Azure Functions. The working solution for now would be to migrate your project to V2 of Azure Functions (i.e. .Net Core version which is currently in beta).

@hovsepm hovsepm assigned hovsepm and unassigned jianghaolu Apr 16, 2018
@hovsepm
Copy link
Contributor

hovsepm commented Apr 16, 2018

The issue is not in the Newtonsoft.Json but in Microsoft.Rest.ClientRuntime library in Azure Functions V1 and affects all the Azure management libraries generated by Autorest. The thing is that Azure Functions V1 during runtime loads Microsoft.Rest.ClientRuntime v2.3.3.0 which contains a deserialization bug that was fixed in v2.3.4 according to github issue Azure/azure-sdk-for-net#2501 .

@shilsmarty
Copy link

i think this issue still persist.

"The thing is that Azure Functions V1 during runtime loads Microsoft.Rest.ClientRuntime v2.3.3.0 which contains a deserialization bug that was fixed in v2.3.4 according to github issue Azure/azure-sdk-for-net#2501 ."

Am using Microsoft.Rest.ClientRuntime version v2.3.10 but still same error as above.

@hovsepm
Copy link
Contributor

hovsepm commented May 1, 2018

@shilsmarty you will need to migrate your project to .Net Core because the issue is not fixed yet. It does not matter what version of Microsoft.Rest.ClientRuntime you reference for your project - Azure Functions V1 during the runtime loads Microsoft.Rest.ClientRuntime v2.3.3.0 anyway.

@hovsepm
Copy link
Contributor

hovsepm commented May 15, 2018

Fix in Azure Functions V1 was updated and deployed with the last 1.0 release (1.0.11702).
Please open a new issue and provide detailed information on region and Azure Functions runtime version if you will still hit this.

@hovsepm hovsepm closed this as completed May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants