Azure-rest-api-specs: LogAnalytics.Solutions API failed to unmarshal response body

Created on 2 Jun 2020  路  8Comments  路  Source: Azure/azure-rest-api-specs

After tested, I found LogAnalytics.Solutions API failed to unmarshal response body and threw below error message when it failed to create solution.

Request body:

PUT https://management.azure.com/subscriptions/xx-xx-xx-xx/resourcegroups/acctestRG-01test2/providers/Microsoft.OperationsManagement/solutions/Containers(acctest-test012)


{
    "location": "westeurope",
    "plan": {
        "name": "Containers(acctest-test012)",
        "publisher": "Microsoft",
        "promotionCode": "",
        "product": "OMSGallery/AzureSQLAnalytics"
    },
    "properties": {
        "workspaceResourceId": "/subscriptions/xx-xx-xx-xx/resourcegroups/acctestrg-01test2/providers/microsoft.operationalinsights/workspaces/acctest-test012"
    }
}

Error message:

pollingTrackerBase#updateRawBody: failed to unmarshal response body: StatusCode=0 -- Original Error: invalid character 'F' looking for beginning of value
Monitor - LogAnalytics Service Attention

Most helpful comment

@neil-yechenwei the error was thrown here
go-autorest is expecting the error message to be a JSON string, but instead, the service returns the error message as a string literal

For first party solution, the solution name has to be convention of solutionType(workspaceName), and the product has to be OMSGallery/solutionType. For example, product OMSGallery/ChangeTracking, solution name ChangeTracking(myworkspace)

which is not a legal JSON string (legal JSON string should start with curly brace), therefore you will get the error message of invalid character 'F' looking for beginning of value complaining the first character is F.

This should be a service issue, in convention we are expecting that everything returned from the service should be a JSON string rather than plain string.
And particular in this case, this should be a shortage of the current swagger - it cannot describe the format of async errors.

All 8 comments

@neil-yechenwei Is it a client issue? which client you used.

@ArcturusZhang Could you pls take a took at this go SDK issue?

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

This seems like something is wrong in the async polling response, @neil-yechenwei could you please provide some log when the error was raised?

@ArcturusZhang , after checked, I think the real error message is For first party solution, the solution name has to be convention of solutionType(workspaceName), and the product has to be OMSGallery/solutionType. For example, product OMSGallery/ChangeTracking, solution name ChangeTracking(myworkspace) and seems the response with error message is failed to be unmarshalled in function pt.initializeState().
image
image

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

@neil-yechenwei the error was thrown here
go-autorest is expecting the error message to be a JSON string, but instead, the service returns the error message as a string literal

For first party solution, the solution name has to be convention of solutionType(workspaceName), and the product has to be OMSGallery/solutionType. For example, product OMSGallery/ChangeTracking, solution name ChangeTracking(myworkspace)

which is not a legal JSON string (legal JSON string should start with curly brace), therefore you will get the error message of invalid character 'F' looking for beginning of value complaining the first character is F.

This should be a service issue, in convention we are expecting that everything returned from the service should be a JSON string rather than plain string.
And particular in this case, this should be a shortage of the current swagger - it cannot describe the format of async errors.

Was this page helpful?
0 / 5 - 0 ratings