Hi there, Running into an issue with `WebAppDiagn...
# azure
c
Hi there, Running into an issue with
WebAppDiagnosticLogsConfiguration
. Whenever an webapp is failing, it eventually gets removed as well apparently. This causes issues the next time I try to update the stack, as the
WebAppDiagnosticLogsConfiguration
can't seem to work out its dependencies properly (it looks like it's trying to create the LogsConfiguration before the actual app/site exists).
Copy code
azure-native:web:WebAppDiagnosticLogsConfiguration (foobar-logging):
    error: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.Web/sites/foobar' under resource group 'rg-testing' was not found. For more details please go to <https://aka.ms/ARMResourceNotFoundFix>"
This is my configuration resource:
Copy code
var loggingConfiguration = new WebAppDiagnosticLogsConfiguration(
            $"{args.ProjectName}-app-logging-{args.StackName}", new WebAppDiagnosticLogsConfigurationArgs
            {
                ResourceGroupName = args.ResourceGroupName,
                Name = app.Name,
                ApplicationLogs = new ApplicationLogsConfigArgs
                {
                    FileSystem = new FileSystemApplicationLogsConfigArgs
                    {
                        Level = LogLevel.Verbose,
                    },
                },
                DetailedErrorMessages = new EnabledConfigArgs
                {
                    Enabled = true
                },
                HttpLogs = new HttpLogsConfigArgs
                {
                    FileSystem = new FileSystemHttpLogsConfigArgs
                    {
                        Enabled = true,
                        RetentionInDays = 7,
                        RetentionInMb = 25
                    }
                }
            }, new CustomResourceOptions
            {
                DeletedWith = app,
                DependsOn = new InputList<Resource> { app, appServicePlan }
            });
As you can see, I've also attempted to add both the app and service plan as explicit dependencies, but it doesn't seem to make any difference. Any hints on how to resolve this? And yes, I have also refreshed the stack.
it looks like it's trying to create the LogsConfiguration before the actual app/site exists
Actually, it rather looks like it's trying to delete the old logs configuration. Which then fails, because the site doesn't exist anymore. I tried then to set
DeleteBeforeReplace = false
, but without any luck. 🤷‍♂️
Copy code
I0802 13:19:19.490716   17754 log.go:80] eventSink::Infoerr(<{%reset%}>I0802 13:19:19.490680   17787 log.go:75] azure-native.Delete(urn:pulumi:testing::Superagent.Backend.Infrastructure::azure-native:web:WebAppDiagnosticLogsConfiguration::Superagent.Api.GraphQL.Tenant-app-logging-testing) executing
<{%reset%}>)
I0802 13:19:19.490924   17754 log.go:80] eventSink::Infoerr(<{%reset%}>I0802 13:19:19.490887   17787 log.go:75] HTTP Request Begin PUT <https://management.azure.com/subscriptions/6c17bcb7-9e02-4a75-a890-1a96d647863f/resourceGroups/rg-testing/providers/Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing/config/logs?api-version=2020-12-01> ===================================================
<{%reset%}>)
I0802 13:19:19.490960   17754 log.go:80] eventSink::Infoerr(<{%reset%}>PUT /subscriptions/6c17bcb7-9e02-4a75-a890-1a96d647863f/resourceGroups/rg-testing/providers/Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing/config/logs?api-version=2020-12-01 HTTP/1.1
<{%reset%}>)
I0802 13:19:19.490969   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Host: <http://management.azure.com|management.azure.com>
<{%reset%}>)
I0802 13:19:19.490977   17754 log.go:80] eventSink::Infoerr(<{%reset%}>User-Agent: Go/go1.19.9 (arm64-darwin) go-autorest/v14.2.1 pulumi-azure-native/1.103.0 pid-a90539d8-a7a6-5826-95c4-1fbef22d4b22
<{%reset%}>)
I0802 13:19:19.490984   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Content-Length: 37
<{%reset%}>)
I0802 13:19:19.490990   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Content-Type: application/json; charset=utf-8
<{%reset%}>)
I0802 13:19:19.490996   17754 log.go:80] eventSink::Infoerr(<{%reset%}>{"properties":{"applicationLogs":{}}}
<{%reset%}>)
I0802 13:19:19.491003   17754 log.go:80] eventSink::Infoerr(<{%reset%}>===================================================== HTTP Request End PUT <https://management.azure.com/subscriptions/6c17bcb7-9e02-4a75-a890-1a96d647863f/resourceGroups/rg-testing/providers/Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing/config/logs?api-version=2020-12-01>
<{%reset%}>)
I0802 13:19:19.581196   17754 log.go:80] eventSink::Infoerr(<{%reset%}>I0802 13:19:19.581160   17787 log.go:75] HTTP Response Begin PUT [<https://management.azure.com/subscriptions/6c17bcb7-9e02-4a75-a890-1a96d647863f/resourceGroups/rg-testing/providers/Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing/config/logs?api-version=2020-12-01> ===================================================
<{%reset%}>)
I0802 13:19:19.581254   17754 log.go:80] eventSink::Infoerr(<{%reset%}>HTTP/2.0 404 Not Found
<{%reset%}>)
I0802 13:19:19.581264   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Content-Length: 236
<{%reset%}>)
I0802 13:19:19.581280   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Cache-Control: no-cache
<{%reset%}>)
I0802 13:19:19.581289   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Content-Type: application/json; charset=utf-8
<{%reset%}>)
I0802 13:19:19.581298   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Date: Wed, 02 Aug 2023 11:19:18 GMT
<{%reset%}>)
I0802 13:19:19.581303   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Expires: -1
<{%reset%}>)
I0802 13:19:19.581311   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Pragma: no-cache
<{%reset%}>)
I0802 13:19:19.581323   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Strict-Transport-Security: max-age=31536000; includeSubDomains
<{%reset%}>)
I0802 13:19:19.581345   17754 log.go:80] eventSink::Infoerr(<{%reset%}>X-Content-Type-Options: nosniff
<{%reset%}>)
I0802 13:19:19.581353   17754 log.go:80] eventSink::Infoerr(<{%reset%}>X-Ms-Correlation-Request-Id: 73f20cd1-4c9d-4673-a33f-77a63e5419e4
<{%reset%}>)
I0802 13:19:19.581360   17754 log.go:80] eventSink::Infoerr(<{%reset%}>X-Ms-Failure-Cause: gateway
<{%reset%}>)
I0802 13:19:19.581366   17754 log.go:80] eventSink::Infoerr(<{%reset%}>X-Ms-Request-Id: 73f20cd1-4c9d-4673-a33f-77a63e5419e4
<{%reset%}>)
I0802 13:19:19.581373   17754 log.go:80] eventSink::Infoerr(<{%reset%}>X-Ms-Routing-Request-Id: NORWAYEAST:20230802T111919Z:73f20cd1-4c9d-4673-a33f-77a63e5419e4
<{%reset%}>)
I0802 13:19:19.581384   17754 log.go:80] eventSink::Infoerr(<{%reset%}>{"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing' under resource group 'rg-testing' was not found. For more details please go to <https://aka.ms/ARMResourceNotFoundFix>"}}
<{%reset%}>)
I0802 13:19:19.581409   17754 log.go:80] eventSink::Infoerr(<{%reset%}>===================================================== HTTP Response End PUT <https://management.azure.com/subscriptions/6c17bcb7-9e02-4a75-a890-1a96d647863f/resourceGroups/rg-testing/providers/Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing/config/logs?api-version=2020-12-01>
<{%reset%}>)
I0802 13:19:19.581454   17754 log.go:80] eventSink::Infoerr(<{%reset%}>I0802 13:19:19.581188   17787 log.go:75] HTTP Response Begin PUT [<https://management.azure.com/subscriptions/6c17bcb7-9e02-4a75-a890-1a96d647863f/resourceGroups/rg-testing/providers/Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing/config/logs?api-version=2020-12-01> ===================================================
<{%reset%}>)
I0802 13:19:19.581466   17754 log.go:80] eventSink::Infoerr(<{%reset%}>HTTP/2.0 404 Not Found
<{%reset%}>)
I0802 13:19:19.581474   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Content-Length: 236
<{%reset%}>)
I0802 13:19:19.581484   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Cache-Control: no-cache
<{%reset%}>)
I0802 13:19:19.581505   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Content-Type: application/json; charset=utf-8
<{%reset%}>)
I0802 13:19:19.581518   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Date: Wed, 02 Aug 2023 11:19:18 GMT
<{%reset%}>)
I0802 13:19:19.581534   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Expires: -1
<{%reset%}>)
I0802 13:19:19.581540   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Pragma: no-cache
<{%reset%}>)
I0802 13:19:19.581545   17754 log.go:80] eventSink::Infoerr(<{%reset%}>Strict-Transport-Security: max-age=31536000; includeSubDomains
<{%reset%}>)
I0802 13:19:19.581553   17754 log.go:80] eventSink::Infoerr(<{%reset%}>X-Content-Type-Options: nosniff
<{%reset%}>)
I0802 13:19:19.581579   17754 log.go:80] eventSink::Infoerr(<{%reset%}>X-Ms-Correlation-Request-Id: 73f20cd1-4c9d-4673-a33f-77a63e5419e4
<{%reset%}>)
I0802 13:19:19.581588   17754 log.go:80] eventSink::Infoerr(<{%reset%}>X-Ms-Failure-Cause: gateway
<{%reset%}>)
I0802 13:19:19.581594   17754 log.go:80] eventSink::Infoerr(<{%reset%}>X-Ms-Request-Id: 73f20cd1-4c9d-4673-a33f-77a63e5419e4
<{%reset%}>)
I0802 13:19:19.581608   17754 log.go:80] eventSink::Infoerr(<{%reset%}>X-Ms-Routing-Request-Id: NORWAYEAST:20230802T111919Z:73f20cd1-4c9d-4673-a33f-77a63e5419e4
<{%reset%}>)
I0802 13:19:19.581627   17754 log.go:80] eventSink::Infoerr(<{%reset%}>{"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing' under resource group 'rg-testing' was not found. For more details please go to <https://aka.ms/ARMResourceNotFoundFix>"}}
<{%reset%}>)
I0802 13:19:19.581636   17754 log.go:80] eventSink::Infoerr(<{%reset%}>===================================================== HTTP Response End PUT <https://management.azure.com/subscriptions/6c17bcb7-9e02-4a75-a890-1a96d647863f/resourceGroups/rg-testing/providers/Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing/config/logs?api-version=2020-12-01>
<{%reset%}>)
I0802 13:19:19.581781   17754 log.go:80] provider received rpc error `Unknown`: `autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing' under resource group 'rg-testing' was not found. For more details please go to <https://aka.ms/ARMResourceNotFoundFix>"`
I0802 13:19:19.581792   17754 log.go:80] rpc error kind `Unknown` may not be recoverable
I0802 13:19:19.581799   17754 log.go:80] Provider[azure-native, 0x140017d4e60].Delete(urn:pulumi:testing::Superagent.Backend.Infrastructure::azure-native:web:WebAppDiagnosticLogsConfiguration::Superagent.Api.GraphQL.Tenant-app-logging-testing,/subscriptions/6c17bcb7-9e02-4a75-a890-1a96d647863f/resourceGroups/rg-testing/providers/Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing/config/logs) failed: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing' under resource group 'rg-testing' was not found. For more details please go to <https://aka.ms/ARMResourceNotFoundFix>"
I0802 13:19:19.581808   17754 log.go:80] eventSink::Error(<{%reset%}>autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.Web/sites/SuperagentApiGraphQLTenant-testing' under resource group 'rg-testing' was not found. For more details please go to <https://aka.ms/ARMResourceNotFoundFix>"<{%reset%}>)
Confirmed. It's trying to delete the logging config resource, and effectively issues a
PUT .../config/logs
to clear the logging config.
pulumi state delete "<urn-of-WebAppDiagnosticLogsConfiguration>"
fixed the issue for now, but very interested in how I can avoid this from occuring again in the future.