Azure / Azure/azure-functions-host

Syncing function triggers by calling the functions runtime site failed

Open
#10,078 7 comments 0 reactions 0 assignees View on GitHub
needs-investigation
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 10h
Merged PRs (30d)
36

Description

#### Check for a solution in the Azure portal

I just noticed an error in two of our Function Apps today, and both in DEV and PROD.

In the Azure Portal, it's showing "Runtime version: Error", and says:
We were not able to load some functions in the list due to errors. Refresh the page to try again. See details

Clicking 'see details' gives:
![image](https://github.com/Azure/azure-functions-host/assets/13594550/3655c542-e1ee-477a-b5b0-d479695cdb26)

It appears to be a problem syncing the web app triggers.

Strange thing, a different Function App, both in DEV and PROD, is fine and shows all the functions.

At this point, I have no idea what to investigate further. The APIs in the Function Apps seem to be up and running, but I'm concerned that they may stop working at some point.

The problem Function Apps load fine locally, and lists out all available functions.

I don't remember seeing this issue before, and looking at the last month, I'm not seeing any other errors in the Activity Log about this (prior to today), except for one on Apr 14.

I tried restarting the function apps, redeploying code, etc. and nothing changed the behavior. Also, this started out of the blue, and wasn't related to a recent new code deployment.

#### Expected behavior

Sync triggers to work correctly, and not give Forbidden or InternalServerError.

#### Actual behavior
Provide a description of the actual behavior observed.

Kudu logs shows:
```
This XML file does not appear to have any style information associated with it. The document tree is shown below.

```

Activity log shows this error:
```json
{
"authorization": {
"action": "Microsoft.Web/sites/host/sync/action",
"scope": "/subscriptions/redacted/resourceGroups/redacted/providers/Microsoft.Web/sites/redacted-functions/host/default"
},
"caller": "redacted",
"channels": "Operation",
"claims": {
[...]
},
"correlationId": "97decc8c-f17f-4aa0-9123-f59d7a12bf99",
"description": "",
"eventDataId": "0def156f-c83f-403e-9b44-4953e0eb9e62",
"eventName": {
"value": "EndRequest",
"localizedValue": "End request"
},
"category": {
"value": "Administrative",
"localizedValue": "Administrative"
},
"eventTimestamp": "2024-04-29T02:23:01.7365522Z",
"id": "/subscriptions/redacted/resourceGroups/redacted/providers/Microsoft.Web/sites/redacted-functions/host/default/events/0def156f-c83f-403e-9b44-4953e0eb9e62/ticks/638499541817365522",
"level": "Error",
"operationId": "bfa3928d-a50f-4c0c-b76c-ab815522fa9b",
"operationName": {
"value": "Microsoft.Web/sites/host/sync/action",
"localizedValue": "Sync Web Apps Function Triggers"
},
"resourceGroupName": "redacted",
"resourceProviderName": {
"value": "Microsoft.Web",
"localizedValue": "Azure Web Sites"
},
"resourceType": {
"value": "Microsoft.Web/sites/host",
"localizedValue": "Microsoft.Web/sites/host"
},
"resourceId": "/subscriptions/redacted/resourceGroups/redacted/providers/Microsoft.Web/sites/redacted-functions/host/default",
"status": {
"value": "Failed",
"localizedValue": "Failed"
},
"subStatus": {
"value": "BadRequest",
"localizedValue": "Bad Request (HTTP Status Code: 400)"
},
"submissionTimestamp": "2024-04-29T02:26:03Z",
"subscriptionId": "redacted",
"tenantId": "7eb49dfd-a75d-4a38-9690-3b68b5efe173",
"properties": {
"statusCode": "BadRequest",
"serviceRequestId": null,
"statusMessage": "{\"Code\":\"BadRequest\",\"Message\":\"Encountered an error (InternalServerError) from host runtime.\",\"Target\":null,\"Details\":[{\"Message\":\"Encountered an error (InternalServerError) from host runtime.\"},{\"Code\":\"BadRequest\"},{\"ErrorEntity\":{\"Code\":\"BadRequest\",\"Message\":\"Encountered an error (InternalServerError) from host runtime.\"}}],\"Innererror\":null}",
"eventCategory": "Administrative",
"entity": "/subscriptions/redacted/resourceGroups/redacted/providers/Microsoft.Web/sites/redacted-functions/host/default",
"message": "Microsoft.Web/sites/host/sync/action",
"hierarchy": "7eb49dfd-a75d-4a38-9690-3b68b5efe173/redacted"
},
"relatedEvents": []
}
```

#### Related information

Provide any related information

.NET 6, C#
Microsoft.NET.Sdk.Functions: 4.3.0

Contributor guide

Open the contributing guide

Research direction

Start with the Kudu log entries for /admin/host/synctriggers and the referenced PostDeploymentHelper.cs locations, especially lines 299, 302, and 720. Compare the failed runtime sync with the successful /operations/settriggers fallback and inspect the Azure Activity Log details. Done means identifying a reproducible cause for the 500 response and confirming that trigger synchronization completes without the portal error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
api, backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.