Azure Function 4 deployment fails with "Encountered an error (BadGateway) from host runtime."

Zoltan Solya 51 Reputation points
2024-04-15T17:11:12.1733333+00:00

A few days ago, I started getting the infamous "BadGateway" errors when I attempted to deploy a new version of my Azure Function. Yes, it is the dreaded "Syncing Triggers" issue...(debug log below)

This was working before, I made numerous successful deployments in the past. Yes, I tried removing the WEBSITE_RUN_FROM_PACKAGE setting, to no avail. I tried deploying from VS Code, from PowerShell, I re-deployed the Azure resources, nothing helped.

It's an Azure Function 4, running on Linux, linuxFxVersion is set to "DOTNET-ISOLATED|8.0".

Does anyone have an idea what am I doing wrong? Any help is appreciated!

Syncing Triggers...
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 12a05a9f-d2ab-427e-83af-16f41d5c5c61
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/<redacted>/syncfunctiontriggers?api-version=2022-03-01'
cli.azure.cli.core.sdk.policies: Request method: 'POST'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': 'c1a4481c-fb49-11ee-9555-faf2c864b201'
cli.azure.cli.core.sdk.policies:     'CommandName': 'functionapp deployment source config-zip'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '-g -n --src --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.53.0 (HOMEBREW) azsdk-python-azure-mgmt-web/7.0.0 Python/3.10.13 (macOS-14.4.1-arm64-arm-64bit)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "POST /subscriptions/<redacted>/syncfunctiontriggers?api-version=2022-03-01 HTTP/1.1" 400 322
cli.azure.cli.core.sdk.policies: Response status: 400
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Content-Length': '322'
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies:     'Expires': '-1'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'Server': 'Microsoft-IIS/10.0'
cli.azure.cli.core.sdk.policies:     'X-AspNet-Version': '4.0.30319'
cli.azure.cli.core.sdk.policies:     'X-Powered-By': 'ASP.NET'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-subscription-writes': '1199'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': 'fda8479b-ea63-4ba6-b5a5-c8fcc8e3b392'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': 'fda8479b-ea63-4ba6-b5a5-c8fcc8e3b392'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'UKSOUTH:20240415T170144Z:fda8479b-ea63-4ba6-b5a5-c8fcc8e3b392'
cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies:     'Date': 'Mon, 15 Apr 2024 17:01:43 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"Code":"BadRequest","Message":"Encountered an error (BadGateway) from host runtime.","Target":null,"Details":[{"Message":"Encountered an error (BadGateway) from host runtime."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","Message":"Encountered an error (BadGateway) from host runtime."}}],"Innererror":null}
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,185 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Zoltan Solya 51 Reputation points
    2024-04-15T21:04:42.04+00:00

    ...and as usual, the culprit was a missing configuration key. Really? Why does it result a BadRequest?

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.