Azure / Azure/azure-rest-api-specs
Log Analytics ClusterClient.Update returns string literal `null` as json response body
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 424
Description
Hi,
We've encountered an issue in updating Log Analytics clusters. When sending an Update request, the response is returned as an HTTP 202 Accepted (formally this returned 200) and the JSON response body is a string literal `null` which causes a crash in `go-autorest` [here](https://github.com/Azure/go-autorest/blob/cbd6c47773f1a521faa3a39f3e9455620a751ae8/autorest/azure/azure.go#L313).
Additional Info
Request:
```
:authority: management.azure.com
:method: PATCH
:path: /subscriptions/******/resourcegroups/acctestRG-la-210108080034968174/providers/Microsoft.OperationalInsights/clusters/acctest-LA-210108080034968174?api-version=2020-08-01
:scheme: https
content-type: application/json; charset=utf-8
user-agent: Go/go1.15.6 (amd64-darwin) go-autorest/v14.2.1 Azure-SDK-For-Go/v49.2.0 operationalinsights/2020-08-01 HashiCorp Terraform/0.12.7-sdk (+https://www.terraform.io) Terraform Plugin SDK/1.13.1 terraform-provider-azurerm/dev pid-222c6c49-1b0a-5959-a213-6608f9eb8820
authorization: [REDACTED]
x-ms-correlation-request-id: 8e1c12bf-8585-e13f-6f45-d673652ac096
content-length: 161
accept-encoding: gzip
{"properties":{"keyVaultProperties":{"keyVaultUri":"https://******.vault.azure.net/","keyName":"key-ahvzt","keyVersion":"5acf16780cb1429c88a4f9208898801a"}}}
```
Response:
```
:status: 202
cache-control: no-cache
pragma: no-cache
content-length: 4
content-type: application/json; charset=utf-8
expires: -1
location: https://management.azure.com/subscriptions/******/resourceGroups/acctestRG-la-210108080034968174/providers/Microsoft.OperationalInsights/clusters/acctest-LA-210108080034968174/operationresults/bcaf2116-167f-45d6-bf73-e73f07a74462?api-version=2020-08-01
azure-asyncoperation: https://management.azure.com/subscriptions/******/providers/Microsoft.OperationalInsights/locations/westeurope/operationStatuses/bcaf2116-167f-45d6-bf73-e73f07a74462?api-version=2015-11-01-preview
x-ams-apiversion: WebAPI1.0
cachecontrol: no-cache
x-ms-request-id: eceebbd9-8f3b-4f0d-93d5-a55b0bcb2943
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
server: Microsoft-IIS/10.0
server: Microsoft-IIS/10.0
x-powered-by: ASP.NET
x-powered-by: ASP.NET
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id: 8e1c12bf-8585-e13f-6f45-d673652ac096
x-ms-routing-request-id: UKWEST:20210108T103620Z:8a5118bb-13cf-4703-9662-973a33c7240e
date: Fri, 08 Jan 2021 10:36:19 GMT
null
```
Contributor guide
Research direction
Start with the Log Analytics ClusterClient.Update operation for API version 2020-08-01 and compare its documented 202 response with the captured response body. The issue also links go-autorest/azure/azure.go at the failing response-handling code; done means the API specification accurately represents the accepted response and no longer causes this client failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100