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

WebAppSiteExtension : Extension Install Failed #558

Open
stawen opened this issue Feb 10, 2021 · 6 comments
Open

WebAppSiteExtension : Extension Install Failed #558

stawen opened this issue Feb 10, 2021 · 6 comments
Labels
kind/bug Some behavior is incorrect or out of spec upstream/open-api

Comments

@stawen
Copy link

stawen commented Feb 10, 2021

hi,

With Azure nextGen, I build a windows App Service Plan. and webapp, I want to activate an extension (here dynatrace, same problem with others).
All resources are created correctly unless extension

I've got this error

(Code = "Failed" Message = "The async operation failed).

I test with an ARM template and it worked. I based my pulumi code on the ARM template.

Steps to Reproduce

Pulumi code

Just WebAppSiteExtension doesn't work

(Code = "Failed" Message = "The async operation failed).
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

import * as web_v20200901 from "@pulumi/azure-nextgen/web/v20200901";
import * as web_v20181101 from "@pulumi/azure-nextgen/web/v20181101";

// Create an Azure Resource Group
export const rg = new azure.core.ResourceGroup(`rg-demo-webapp-java`, {
    name : `rg-demo-webapp-java-dev`,
});

//--------------------------------------------------------------------------
// Create Azure Web APP (App Service Plan Windows) | Provider Azure-NextGen
//--------------------------------------------------------------------------

// App Service Plan = ServerFarm
const appServicePlanWindows = new web_v20200901.AppServicePlan("asp-webbapp-w-java", {
    name: `asp-webbapp-w-java-dev`,
    resourceGroupName: rg.name,
    location: rg.location,
    kind: "app",
    
    sku: {
        name: "S1",
        tier: "Standard",
        size: "S1",
        family: "S",
        capacity: 1,
    },
});

const appDemoWindows = new web_v20181101.WebApp(`demo-webapp-w-java`, {
    resourceGroupName: rg.name,
    location: appServicePlanWindows.location,
    name: `demo-webapp-w-java-dev`,
    serverFarmId: appServicePlanWindows.id,
    
    siteConfig: {
        appSettings: [ //Env Var
            {
                name: "VAR",
                value: "test"
            },
        ],
        // Runtime
        javaVersion: "11",
        javaContainer: "JAVA",
        javaContainerVersion: "SE",
        alwaysOn: true,
    }    
});

const extDynatrace = new web_v20181101.WebAppSiteExtension('dynatrace-siteExtension',{
    resourceGroupName: rg.name,
    name: appDemoWindows.name,
    siteExtensionId: "Dynatrace"
})

Template ARM that work

In this ARM, i create only extension on previously resource created

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "sites_demo_webapp_w_java_dev_name": {
            "defaultValue": "demo-webapp-w-java-dev",
            "type": "String"
        },
        "serverfarms_asp_webbapp_w_java_dev_externalid": {
            "defaultValue": "/subscriptions/<sub-id>/resourceGroups/rg-demo-webapp-java-dev/providers/Microsoft.Web/serverfarms/asp-webbapp-w-java-dev",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [{
        "type": "Microsoft.Web/sites/siteextensions",
        "apiVersion": "2018-11-01",
        "name": "[concat(parameters('sites_demo_webapp_w_java_dev_name'), '/Dynatrace')]",
        "location": "France Central"
    }]
}

AZURE API REST

We see this issues Azure/azure-rest-api-specs#2819

As suggested by @hovsepm here, Azure SDK calls fail to create site extensions when they attempt to PUT a request with null content. Setting request body to an empty JSON object ({}) fixes the problem.

so we test it and voila, if you leave your body empty, it doesn't work,

image

but if you put {}, it's work !

image

if this can help you to solved it ;)

Context (Environment)

Azure France Central
@pulumi/[email protected]
@pulumi/[email protected]
@pulumi/[email protected]
@types/[email protected]

@mikhailshilkov
Copy link
Member

Thank you for such a detailed issue and investigation!

Indeed, we are not sending any body because the API spec defines no body parameters.

It seems like we behave similarly to the Azure SDK here, which is always our first comparison.

We could send an empty body for such cases. However, a quick check shows that there are several dozens of resources without a body parameter - we would need to test how they behave for empty body vs. nil body.

@stack72 stack72 transferred this issue from pulumi/pulumi-azure-nextgen Mar 2, 2021
@mikhailshilkov mikhailshilkov added kind/bug Some behavior is incorrect or out of spec upstream/open-api labels Mar 3, 2021
@stawen
Copy link
Author

stawen commented Mar 9, 2022

@mikhailshilkov hi, for information, i have tested with azure-native, i have the same issue.

@gpduck
Copy link

gpduck commented Mar 11, 2022

I'm having the same problem with the same site extension. Would it be possible to add a property to the auto-generated code that would allow us to either add the body or not and thus avoid possibly breaking other extensions?

@gpduck
Copy link

gpduck commented Mar 30, 2022

FYI I've opened up an issue on the Azure SDK project for this as well since it is also broken.

Azure/azure-sdk-for-js#21116

@AIZ-THerring
Copy link

a quick check shows that there are several dozens of resources without a body parameter

I'm fairly certain that a PUT operation is always supposed to have a body:

image

@jonathan-mcewan
Copy link

jonathan-mcewan commented Apr 16, 2024

Hey guys,

This realistically is a server / documentation issue, probably not an Azure SDK issue (which is probably why it's being ignored by MS?). I can confirm that sending {} in the PUT command successfully creates the WebAppSiteExtension.

@mikhailshilkov the complexities and risks of going against the documentation understandable. If only MS's API's had a little more resilience we wouldn't be in this situation where there's no movement from any side, and everyone suffers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec upstream/open-api
Projects
None yet
Development

No branches or pull requests

5 participants