Azure / azure-sdk-for-go

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:
https://docs.microsoft.com/azure/developer/go/
MIT License
1.62k stars 822 forks source link

BeginInstallSiteExtension and BeginInstallSiteExtensionSlot Return 400 Bad Request Without Error Code or Response Body #23516

Open Sylfwood opened 2 hours ago

Sylfwood commented 2 hours ago

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.

github-actions[bot] commented 2 hours ago

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