azure-sdk-for-go
azure-sdk-for-go copied to clipboard
BeginInstallSiteExtension and BeginInstallSiteExtensionSlot Return 400 Bad Request Without Error Code or Response Body
Bug Report
package: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice
SDK version: V4 (the error is also present in V2 and V3 versions)
Output of go version: go version go1.22.4 darwin/arm64
The functions BeginInstallSiteExtension
and BeginInstallSiteExtensionSlot
from WebAppsClient
return a status code 400 Bad Request without an error code and no response body when attempting to install a site extension:
unable to initiate installation of site extension: PUT https://management.azure.com/subscriptions/********-****-****-****-************/resourceGroups/*****/providers/Microsoft.Web/sites/*****/siteextensions/Datadog.AzureAppServices.DotNet
--------------------------------------------------------------------------------
RESPONSE 400: 400 Bad Request
ERROR CODE UNAVAILABLE
--------------------------------------------------------------------------------
Response contained no body
--------------------------------------------------------------------------------
FAIL
I expected the client to successfully initiate the installation of the site extension without errors. Alternatively, if there is an error, I expected a detailed error message with an error code and response body to help diagnose the issue. Notably, the DeleteSiteExtension
and DeleteSiteExtensionSlot
functions return an error with status code 200... I can parse the ResponseError
to check the StatusCode
, but not ideal.
Here's a snippet of the code that reproduces the issue:
package azure
import (
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
armappserviceV4 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice/v4"
)
type WebAppsClient struct {
inner armappserviceV4.WebAppsClient
}
type SupportedSiteExtension string
const (
DatadogAzureAppServicesNodeApm SupportedSiteExtension = "Datadog.AzureAppServices.Node.Apm"
DatadogAzureAppServicesDotNetApm SupportedSiteExtension = "Datadog.AzureAppServices.DotNet"
)
func (w *WebAppsClient) InstallProductionSlotSiteExtension(resourceGroup string, appServiceName string, extension SupportedSiteExtension) error {
extensionName := string(extension)
poller, err := w.inner.BeginInstallSiteExtension(ctx, resourceGroup, appServiceName, extensionName, nil)
if err != nil {
return fmt.Errorf("unable to initiate installation of site extension: %w", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
return fmt.Errorf("error while installing site extension: %w", err)
}
return nil
}
If you need any more details, please let me know.