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

Failed to sync triggers for function app . Error: BadRequest - Encountered an error (ServiceUnavailable) from host runtime. (CODE: 400) #16942

Open
Palving opened this issue Sep 22, 2022 · 76 comments

Comments

@Palving
Copy link

Palving commented Sep 22, 2022

Note

Issues in this repo are for tracking bugs, feature requests and questions for the tasks in this repo

For a list:
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

If you have an issue or request for the Azure Pipelines service, use developer community instead:

https://developercommunity.visualstudio.com/spaces/21/index.html )

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name: AzureFunctionApp@1

list here (V# not needed):
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

Environment

  • Server - Azure Pipelines or TFS on-premises?

Azure pipelines

  • Agent - Hosted or Private:

    • If using Hosted agent, provide agent queue name:
      Agent name: 'Azure Pipelines 2'
      Agent machine name: 'fv-az313-661'
      Current agent version: '2.210.1'
      Operating System
      Ubuntu
      20.04.5
      LTS

    • If using private agent, provide the OS of the machine running the agent and the agent version:

Issue Description

Deployment to function apps worked in the beginning but has however started to consistently fail across deployments. Even after deletion and re-deployment of the function app, plans and storage account it fails when zip-deploying. The task itself seems to bring the app down, and it takes a while for it to be available again.

Task logs

This is a linux function app I am trying to deploy with consumption plan

 
 - task: AzureFunctionApp@1
              displayName: "Deploy function app $(functionAppNameChangeFeed)"
              inputs:
                azureSubscription: ${{parameters.serviceConnectionName}}
                appType: "functionAppLinux"
                appName: "$(functionAppNameChangeFeed)"
                deploymentMethod: zipDeploy
                package: "$(System.ArtifactsDirectory)/drop/change/change.zip"

Troubleshooting

Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting

Error logs


2022-09-22T11:40:26.7638914Z ##[debug]Evaluating condition for step: 'Deploy function app dtp-mdcfrch-dev-fa'
2022-09-22T11:40:26.7640403Z ##[debug]Evaluating: SucceededNode()
2022-09-22T11:40:26.7641007Z ##[debug]Evaluating SucceededNode:
2022-09-22T11:40:26.7641942Z ##[debug]=> True
2022-09-22T11:40:26.7642408Z ##[debug]Result: True
2022-09-22T11:40:26.7642912Z ##[section]Starting: Deploy function app dtp-mdcfrch-dev-fa
2022-09-22T11:40:26.7651057Z ==============================================================================
2022-09-22T11:40:26.7651355Z Task         : Azure Functions
2022-09-22T11:40:26.7651700Z Description  : Update a function app with .NET, Python, JavaScript, PowerShell, Java based web applications
2022-09-22T11:40:26.7652010Z Version      : 1.208.2
2022-09-22T11:40:26.7652220Z Author       : Microsoft Corporation
2022-09-22T11:40:26.7652481Z Help         : https://aka.ms/azurefunctiontroubleshooting
2022-09-22T11:40:26.7652797Z ==============================================================================
2022-09-22T11:40:26.7845104Z ##[debug]Using node path: /home/vsts/agents/2.210.1/externals/node10/bin/node
2022-09-22T11:40:26.8862207Z ##[debug]agent.TempDirectory=/home/vsts/work/_temp
2022-09-22T11:40:26.8886921Z ##[debug]loading inputs and endpoints
2022-09-22T11:40:26.8897391Z ##[debug]loading INPUT_AZURESUBSCRIPTION
2022-09-22T11:40:26.8912272Z ##[debug]loading INPUT_APPTYPE
2022-09-22T11:40:26.8916254Z ##[debug]loading INPUT_APPNAME
2022-09-22T11:40:26.8919430Z ##[debug]loading INPUT_DEPLOYTOSLOTORASE
2022-09-22T11:40:26.8922426Z ##[debug]loading INPUT_SLOTNAME
2022-09-22T11:40:26.8925346Z ##[debug]loading INPUT_PACKAGE
2022-09-22T11:40:26.8928297Z ##[debug]loading INPUT_DEPLOYMENTMETHOD
2022-09-22T11:40:26.8932163Z ##[debug]loading ENDPOINT_AUTH_********
2022-09-22T11:40:26.8935750Z ##[debug]loading ENDPOINT_AUTH_SCHEME_********
2022-09-22T11:40:26.8939182Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_********_SERVICEPRINCIPALID
2022-09-22T11:40:26.8942730Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_********_AUTHENTICATIONTYPE
2022-09-22T11:40:26.8946405Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_********_TENANTID
2022-09-22T11:40:26.8949921Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_********_SERVICEPRINCIPALKEY
2022-09-22T11:40:26.8953427Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2022-09-22T11:40:26.8956535Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2022-09-22T11:40:26.8959516Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2022-09-22T11:40:26.8965590Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
2022-09-22T11:40:26.8969037Z ##[debug]loading SECRET_AZURE_APP_SERVICE_KUDU_PRODUCTION_PASSWORD
2022-09-22T11:40:26.8972119Z ##[debug]loaded 18
2022-09-22T11:40:26.8978394Z ##[debug]Agent.ProxyUrl=undefined
2022-09-22T11:40:26.8981347Z ##[debug]Agent.CAInfo=undefined
2022-09-22T11:40:26.8983333Z ##[debug]Agent.ClientCert=undefined
2022-09-22T11:40:26.8985470Z ##[debug]Agent.SkipCertValidation=undefined
2022-09-22T11:40:26.9972276Z ##[debug]agent.proxyurl=undefined
2022-09-22T11:40:26.9973051Z ##[debug]VSTS_ARM_REST_IGNORE_SSL_ERRORS=undefined
2022-09-22T11:40:26.9974292Z ##[debug]AZURE_HTTP_USER_AGENT=VSTS_204de39d-9921-459c-888f-ffe2d2aa12d7_build_640_0
2022-09-22T11:40:27.0336479Z ##[debug]Agent.TempDirectory=/home/vsts/work/_temp
2022-09-22T11:40:27.2541414Z ##[debug]check path : /home/vsts/work/_tasks/AzureFunctionApp_501dd25d-1785-43e4-b4e5-a5c78ccc0573/1.208.2/task.json
2022-09-22T11:40:27.2586693Z ##[debug]adding resource file: /home/vsts/work/_tasks/AzureFunctionApp_501dd25d-1785-43e4-b4e5-a5c78ccc0573/1.208.2/task.json
2022-09-22T11:40:27.2587953Z ##[debug]system.culture=en-US
2022-09-22T11:40:27.2590158Z ##[debug]check path : /home/vsts/work/_tasks/AzureFunctionApp_501dd25d-1785-43e4-b4e5-a5c78ccc0573/1.208.2/node_modules/azure-pipelines-tasks-azurermdeploycommon-v3/module.json
2022-09-22T11:40:27.2592097Z ##[debug]adding resource file: /home/vsts/work/_tasks/AzureFunctionApp_501dd25d-1785-43e4-b4e5-a5c78ccc0573/1.208.2/node_modules/azure-pipelines-tasks-azurermdeploycommon-v3/module.json
2022-09-22T11:40:27.2593813Z ##[debug]system.culture=en-US
2022-09-22T11:40:27.2606675Z ##[debug]azureSubscription=********
2022-09-22T11:40:27.2607732Z ##[debug]appType=functionAppLinux
2022-09-22T11:40:27.2610908Z ##[debug]deployToSlotOrASE=false
2022-09-22T11:40:27.2611724Z ##[debug]customWebConfig=undefined
2022-09-22T11:40:27.2612976Z ##[debug]appSettings=undefined
2022-09-22T11:40:27.2613661Z ##[debug]startUpCommand=undefined
2022-09-22T11:40:27.2614256Z ##[debug]configurationStrings=undefined
2022-09-22T11:40:27.2616971Z ##[debug]appName=dtp-mdcfrch-dev-fa
2022-09-22T11:40:27.2617841Z ##[debug]SlotName : production
2022-09-22T11:40:27.2624453Z ##[debug]******** auth scheme = ServicePrincipalobosbbl
2022-09-22T11:40:27.2626382Z ##[debug]******** data subscriptionid = ********
2022-09-22T11:40:27.2627585Z ##[debug]******** data subscriptionname = ********
2022-09-22T11:40:27.2630124Z ##[debug]******** auth param serviceprincipalid = ***
2022-09-22T11:40:27.2632057Z ##[debug]******** data environmentAuthorityUrl = https://login.windows.net/
2022-09-22T11:40:27.2636985Z ##[debug]******** auth param tenantid = ********
2022-09-22T11:40:27.2637994Z ##[debug]********=https://management.azure.com/
2022-09-22T11:40:27.2638835Z ##[debug]******** data environment = AzureCloud
2022-09-22T11:40:27.2639639Z ##[debug]******** auth scheme = ServicePrincipal
2022-09-22T11:40:27.2640457Z ##[debug]******** data msiclientId = undefined
2022-09-22T11:40:27.2645657Z ##[debug]******** data activeDirectoryServiceEndpointResourceId = https://management.core.windows.net/
2022-09-22T11:40:27.2646750Z ##[debug]******** data AzureKeyVaultServiceEndpointResourceId = https://vault.azure.net
2022-09-22T11:40:27.2647661Z ##[debug]******** data AzureKeyVaultDnsSuffix = vault.azure.net
2022-09-22T11:40:27.2648520Z ##[debug]******** auth param authenticationType = spnKey
2022-09-22T11:40:27.2649363Z ##[debug]credentials spn endpoint
2022-09-22T11:40:27.2650387Z ##[debug]******** auth param serviceprincipalkey = ***
2022-09-22T11:40:27.2651274Z ##[debug]******** data EnableAdfsAuthentication = false
2022-09-22T11:40:27.2655282Z ##[debug]{"subscriptionID":"********","subscriptionName":"********","servicePrincipalClientID":"***","environmentAuthorityUrl":"https://login.windows.net/","tenantID":"********","url":"https://management.azure.com/","environment":"AzureCloud","scheme":"ServicePrincipal","activeDirectoryResourceID":"https://management.azure.com/","azureKeyVaultServiceEndpointResourceId":"https://vault.azure.net","azureKeyVaultDnsSuffix":"vault.azure.net","authenticationType":"spnKey","servicePrincipalKey":***,"isADFSEnabled":false,"applicationTokenCredentials":{"clientId":"***","domain":"********","baseUrl":"https://management.azure.com/","authorityUrl":"https://login.windows.net/","activeDirectoryResourceId":"https://management.azure.com/","isAzureStackEnvironment":false,"authType":"spnKey","secret":***,"isADFSEnabled":false}}
2022-09-22T11:40:27.2708846Z Got service connection details for Azure App Service:'dtp-mdcfrch-dev-fa'
2022-09-22T11:40:27.2710031Z ##[debug][POST]https://login.windows.net/********/oauth2/token/
2022-09-22T11:40:27.4307237Z ##[debug][GET]https://management.azure.com/subscriptions/********/resources?$filter=resourceType EQ 'Microsoft.Web%2FSites' AND name EQ 'dtp-mdcfrch-dev-fa'&api-version=2016-07-01
2022-09-22T11:40:27.9386188Z ##[debug]Correlation ID from ARM api call response : bcdaba9d-04d9-4708-95dd-beb178a47321
2022-09-22T11:40:27.9389028Z ##[debug][GET]https://management.azure.com/subscriptions/********/resources?%24filter=resourceType+EQ+%27Microsoft.Web%2fSites%27+AND+name+EQ+%27dtp-mdcfrch-dev-fa%27&api-version=2016-07-01&%24skiptoken=********
2022-09-22T11:40:28.2581054Z ##[debug]Correlation ID from ARM api call response : 1d10e4b3-03ff-497b-9dfc-00d4c9a60ae6
2022-09-22T11:40:28.2582458Z ##[debug]Resource Group: dtp-mdcfirstrefusad-dev-rg
2022-09-22T11:40:28.2586911Z ##[debug][GET]https://management.azure.com/subscriptions/********/resourceGroups/dtp-mdcfirstrefusad-dev-rg/providers/Microsoft.Web/sites/dtp-mdcfrch-dev-fa/?api-version=2016-08-01
2022-09-22T11:40:28.7602412Z ##[debug]Correlation ID from ARM api call response : 6326fd46-ba88-4cf0-9392-37e1c6373057
2022-09-22T11:40:28.7604804Z ##[debug]Sku: Dynamic
2022-09-22T11:40:28.7968383Z ##[debug]Processed: ##vso[telemetry.publish area=TaskEndpointId;feature=AzureRmWebAppDeployment]{"endpointId":"********"}
2022-09-22T11:40:28.7969746Z ##[debug]package=/home/vsts/work/1/a/drop/change/change.zip
2022-09-22T11:40:28.7970452Z ##[debug]Finding files matching input: /home/vsts/work/1/a/drop/change/change.zip
2022-09-22T11:40:28.7971151Z ##[debug]intially web config parameters :undefined
2022-09-22T11:40:28.7971750Z ##[debug]This is zip package 
2022-09-22T11:40:28.7972302Z ##[debug]runtimeStack=undefined
2022-09-22T11:40:28.7973117Z ##[debug]deploymentMethod=zipDeploy
2022-09-22T11:40:28.7973935Z ##[debug]Deployment started for linux app service
2022-09-22T11:40:28.7974728Z ##[debug]release.releaseId=undefined
2022-09-22T11:40:28.7975437Z ##[debug]Artifact alias of package is: null
2022-09-22T11:40:28.7976085Z ##[debug]set Azure_App_Service_Deploy_PackageArtifactAlias=
2022-09-22T11:40:28.7979841Z ##[debug]Processed: ##vso[task.setvariable variable=Azure_App_Service_Deploy_PackageArtifactAlias;isOutput=false;issecret=false;]
2022-09-22T11:40:28.7980715Z ##[debug]Predeployment Step Started
2022-09-22T11:40:28.7981282Z ##[debug]Deployment Step Started
2022-09-22T11:40:28.7982679Z ##[debug][POST]https://management.azure.com/subscriptions/********/resourceGroups/dtp-mdcfirstrefusad-dev-rg/providers/Microsoft.Web/sites/dtp-mdcfrch-dev-fa/config/appsettings/list?api-version=2016-08-01
2022-09-22T11:40:29.4942886Z ##[debug]Correlation ID from ARM api call response : 3ca88b86-f1f1-429d-9940-63a90ba42ceb
2022-09-22T11:40:29.4943804Z ##[debug]Storage Account is: dtpmdcfirstrefusaddevsa
2022-09-22T11:40:29.7102897Z ##[debug]set SAS_TOKEN=********
2022-09-22T11:40:29.7112993Z ##[debug]Processed: ##vso[task.setvariable variable=SAS_TOKEN;isOutput=false;issecret=true;]***
2022-09-22T11:40:29.7123157Z ##[debug]SAS URL is: https://dtpmdcfirstrefusaddevsa.blob.core.windows.net/azure-pipelines-deploy/package_1663846829501.zip?***
2022-09-22T11:40:29.7125275Z Trying to update App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"https://dtpmdcfirstrefusaddevsa.blob.core.windows.net/azure-pipelines-deploy/package_1663846829501.zip?***"}
2022-09-22T11:40:29.7127147Z ##[debug]Value of WEBSITE_RUN_FROM_PACKAGE has been changed to https://dtpmdcfirstrefusaddevsa.blob.core.windows.net/azure-pipelines-deploy/package_1663846829501.zip?***
2022-09-22T11:40:29.7128933Z ##[debug][PUT]https://management.azure.com/subscriptions/********/resourceGroups/dtp-mdcfirstrefusad-dev-rg/providers/Microsoft.Web/sites/dtp-mdcfrch-dev-fa/config/appsettings?api-version=2016-08-01
2022-09-22T11:40:32.4148386Z ##[debug]Correlation ID from ARM api call response : 19812cc7-122d-4023-9dbd-a6c2efde78be
2022-09-22T11:40:32.4149475Z Updated App Service Application settings.
2022-09-22T11:40:32.4151047Z Updated WEBSITE_RUN_FROM_PACKAGE Application setting to https://dtpmdcfirstrefusaddevsa.blob.core.windows.net/azure-pipelines-deploy/package_1663846829501.zip?***
2022-09-22T11:40:37.4145671Z Syncing triggers for function app
2022-09-22T11:40:37.4148858Z ##[debug][POST]https://management.azure.com/subscriptions/********/resourceGroups/dtp-mdcfirstrefusad-dev-rg/providers/Microsoft.Web/sites/dtp-mdcfrch-dev-fa/syncfunctiontriggers?api-version=2016-08-01
2022-09-22T11:40:37.8723825Z ##[debug]Correlation ID from ARM api call response : f6b97a60-bb98-48b5-be59-1d34cedc0641
2022-09-22T11:40:39.8746450Z ##[debug][POST]https://management.azure.com/subscriptions/********/resourceGroups/dtp-mdcfirstrefusad-dev-rg/providers/Microsoft.Web/sites/dtp-mdcfrch-dev-fa/syncfunctiontriggers?api-version=2016-08-01
2022-09-22T11:40:40.2949240Z ##[debug]Correlation ID from ARM api call response : 043f31ed-0628-484c-b429-a4f8d708905e
2022-09-22T11:40:46.3005867Z ##[debug][POST]https://management.azure.com/subscriptions/********/resourceGroups/dtp-mdcfirstrefusad-dev-rg/providers/Microsoft.Web/sites/dtp-mdcfrch-dev-fa/syncfunctiontriggers?api-version=2016-08-01
2022-09-22T11:40:46.7765215Z ##[debug]Correlation ID from ARM api call response : 7e5a68ad-12c7-4dbf-bfab-a83a347554c8
2022-09-22T11:41:00.7905510Z ##[debug][POST]https://management.azure.com/subscriptions/********/resourceGroups/dtp-mdcfirstrefusad-dev-rg/providers/Microsoft.Web/sites/dtp-mdcfrch-dev-fa/syncfunctiontriggers?api-version=2016-08-01
2022-09-22T11:41:01.1812700Z ##[debug]Correlation ID from ARM api call response : bc0c16ea-39c8-4ce9-b0a2-29e574f9487d
2022-09-22T11:41:31.1913781Z ##[debug][POST]https://management.azure.com/subscriptions/********/resourceGroups/dtp-mdcfirstrefusad-dev-rg/providers/Microsoft.Web/sites/dtp-mdcfrch-dev-fa/syncfunctiontriggers?api-version=2016-08-01
2022-09-22T11:41:31.7971864Z ##[debug]Correlation ID from ARM api call response : 02033f36-c294-41f7-bc30-b6848080b642
2022-09-22T11:41:31.7979540Z ##[debug]Deployment Failed with Error: Error: Failed to sync triggers for function app 'dtp-mdcfrch-dev-fa'. Error: BadRequest - Encountered an error (ServiceUnavailable) from host runtime. (CODE: 400)
2022-09-22T11:41:31.7980593Z ##[debug]task result: Failed
2022-09-22T11:41:31.8015268Z ##[error]Error: Failed to sync triggers for function app 'dtp-mdcfrch-dev-fa'. Error: BadRequest - Encountered an error (ServiceUnavailable) from host runtime. (CODE: 400)
2022-09-22T11:41:31.8023282Z ##[debug]Processed: ##vso[task.issue type=error;]Error: Failed to sync triggers for function app 'dtp-mdcfrch-dev-fa'. Error: BadRequest - Encountered an error (ServiceUnavailable) from host runtime. (CODE: 400)
2022-09-22T11:41:31.8026193Z ##[debug]Processed: ##vso[task.complete result=Failed;]Error: Failed to sync triggers for function app 'dtp-mdcfrch-dev-fa'. Error: BadRequest - Encountered an error (ServiceUnavailable) from host runtime. (CODE: 400)
2022-09-22T11:41:31.8027721Z ##[debug][GET]https://management.azure.com/subscriptions/********/providers/microsoft.insights/components?$filter=InstrumentationKey eq '********'&api-version=2015-05-01
2022-09-22T11:41:31.9564444Z ##[debug]Correlation ID from ARM api call response : 4825fc91-b806-4bae-a17c-32ff4791c7d6
2022-09-22T11:41:31.9566407Z ##[debug]Release.ReleaseUri=undefined
2022-09-22T11:41:31.9567272Z ##[debug]Build.BuildUri=vstfs:///Build/Build/48690
2022-09-22T11:41:31.9568214Z ##[debug]Build.DefinitionName=dtp.mdc.firstrefusaladvertisement CI
2022-09-22T11:41:31.9569301Z ##[debug]Build.BuildNumber=dtp.mdc.FirstRefusalAdvertisement-20220922.11
2022-09-22T11:41:31.9575194Z ##[debug]Build.BuildUri=vstfs:///Build/Build/48690
2022-09-22T11:41:31.9576301Z ##[debug]Release.ReleaseWebUrl=undefined
2022-09-22T11:41:31.9577127Z ##[debug]System.TeamFoundationCollectionUri=https://dev.azure.com/********/
2022-09-22T11:41:31.9579223Z ##[debug]System.TeamProjectId=386d95cb-ab89-42c4-a52f-94d2585f6f12
2022-09-22T11:41:31.9580051Z ##[debug]build.buildId=48690
2022-09-22T11:41:31.9580965Z ##[debug]Build.BuildNumber=dtp.mdc.FirstRefusalAdvertisement-20220922.11
2022-09-22T11:41:31.9581910Z ##[debug]Build.Repository.Name=dtp.mdc.firstrefusaladvertisement
2022-09-22T11:41:31.9582706Z ##[debug]Build.Repository.Provider=TfsGit
2022-09-22T11:41:31.9583463Z ##[debug]Build.SourceBranch=refs/heads/master
2022-09-22T11:41:31.9584300Z ##[debug]Release.ReleaseId=undefined
2022-09-22T11:41:31.9585682Z ##[debug]Release.ReleaseDescription=undefined
2022-09-22T11:41:31.9586451Z ##[debug]Release.DefinitionName=undefined
2022-09-22T11:41:31.9589446Z ##[debug]Release.EnvironmentName=undefined
2022-09-22T11:41:31.9590229Z ##[debug]Release.RequestedForId=undefined
2022-09-22T11:41:31.9590991Z ##[debug]Release.RequestedFor=undefined
2022-09-22T11:41:31.9592828Z ##[debug][PUT]https://management.azure.com/subscriptions/********/resourceGroups/dtp-mdcfirstrefusad-dev-rg/providers/microsoft.insights/components/dtp-mdcfirstrefusad-dev-ai/Annotations?api-version=2015-05-01
2022-09-22T11:41:32.5594305Z ##[debug]Correlation ID from ARM api call response : 416a0270-2a9c-423c-86c9-d4c735fec613
2022-09-22T11:41:32.5598551Z ##[debug]addReleaseAnnotation. Data : {"statusCode":200,"statusMessage":"OK","headers":{"cache-control":"no-cache","pragma":"no-cache","content-length":"639","content-type":"application/json; charset=utf-8","expires":"-1","request-context":"appId=cid-v1:7f83c1fe-8c94-4d55-9337-4ddc696f61ed","access-control-expose-headers":"Request-Context","strict-transport-security":"max-age=31536000; includeSubDomains","x-content-type-options":"nosniff","x-ms-ratelimit-remaining-subscription-writes":"1199","server":"Microsoft-IIS/10.0","x-powered-by":"ASP.NET","x-ms-request-id":"416a0270-2a9c-423c-86c9-d4c735fec613","x-ms-correlation-request-id":"416a0270-2a9c-423c-86c9-d4c735fec613","x-ms-routing-request-id":"WESTEUROPE:20220922T114132Z:416a0270-2a9c-423c-86c9-d4c735fec613","date":"Thu, 22 Sep 2022 11:41:32 GMT","connection":"close"},"body":{"AnnotationName":"dtp.mdc.firstrefusaladvertisement CI - dtp.mdc.FirstRefusalAdvertisement-20220922.11","Id":"1eb2962e-b486-44be-b2e7-bca71dc21a52","Category":"Deployment","Properties":"{\"Label\":\"Error\",\"Deployment Uri\":\"https://dev.azure.com/********/386d95cb-ab89-42c4-a52f-94d2585f6f12/_build?buildId=48690&_a=summary\",\"BuildNumber\":\"dtp.mdc.FirstRefusalAdvertisement-20220922.11\",\"BuildRepositoryName\":\"dtp.mdc.firstrefusaladvertisement\",\"BuildRepositoryProvider\":\"TfsGit\",\"SourceBranch\":\"refs/heads/master\"}","EventTime":"2022-09-22T11:41:31.956+00:00","RelatedAnnotation":null}}
2022-09-22T11:41:32.5603936Z Successfully added release annotation to the Application Insight : dtp-mdcfirstrefusad-dev-ai
2022-09-22T11:41:32.5605291Z ##[debug][POST]https://management.azure.com/subscriptions/********/resourceGroups/dtp-mdcfirstrefusad-dev-rg/providers/Microsoft.Web/sites/dtp-mdcfrch-dev-fa/publishxml?api-version=2016-08-01
2022-09-22T11:41:33.1547685Z ##[debug]Could not parse response: {}
2022-09-22T11:41:33.1548805Z ##[debug]Response: undefined
2022-09-22T11:41:33.1550216Z ##[debug]Correlation ID from ARM api call response : d6e215b2-e66e-4e13-b4ac-922c7ce71b64
2022-09-22T11:41:33.1607107Z App Service Application URL: https://dtp-mdcfrch-dev-fa.azurewebsites.net
2022-09-22T11:41:33.1609263Z ##[debug]set AppServiceApplicationUrl=https://dtp-mdcfrch-dev-fa.azurewebsites.net
2022-09-22T11:41:33.1612030Z ##[debug]Processed: ##vso[task.setvariable variable=AppServiceApplicationUrl;isOutput=false;issecret=false;]https://dtp-mdcfrch-dev-fa.azurewebsites.net
2022-09-22T11:41:33.1613672Z ##[debug]Deployment failed
2022-09-22T11:41:33.1667989Z ##[section]Finishing: Deploy function app dtp-mdcfrch-dev-fa
@github-actions github-actions bot added Area: Release bug environment:need-to-triage Issues need to be triage by environment-deployment team Task: AzureFunction labels Sep 22, 2022
@FBryant87
Copy link

Getting this issue sporadically also, sometimes consistently for long periods of time

@somabodonyi
Copy link

I am only getting this for function apps, that use consumption plans.

@jonraf
Copy link

jonraf commented Sep 26, 2022

Im also getting this issue sometimes.

@maQus123
Copy link

maQus123 commented Sep 26, 2022

Me too (AzureFunctionApp@1, Hosted Agent, Azure Functions Linux Consumption).

Edit: Now, one day later, it worked for whatever reason. Can the action be made more robust please? We need to deploy production soon :D

@Palving
Copy link
Author

Palving commented Sep 27, 2022

Suddenly working for us aswell. Would like some clarification around this issue as we cannot know for certain it will not happen again.

@maQus123
Copy link

@nadesu Would you be so kind and give an update on how likely it is that the problem will persist or continue to occur over the next week(s)? Thank you very much.

@Palving
Copy link
Author

Palving commented Oct 20, 2022

@nadesu Still happening often. Any update? With this error it is unfeasible to use function apps on consumption plans in production environments

@joergen98
Copy link

@nadesu Happening for me aswell

@jacob7395
Copy link

Hi all,

This is an issue for me too, I managed to resolve it by recreating my storage account, service plan and function app the running the config again.

az functionapp deployment source config-zip -g ***-functions -n ***-identity-functions --src src.zip

Prior to rebuilding I was getting the issue consistently, I had changed my plan from Y1 to B1 a few times and also been doing docker deployment to the same functions app. I wonder if the storage account got some garbage in. When running the deploy with --debug the following error was shown.

DEBUG: msal.application: Broker enabled? False
INFO: cli.azure.cli.command_modules.appservice.custom:
Syncing Triggers...
DEBUG: cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
DEBUG: cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
DEBUG: msal.application: Cache hit an AT
DEBUG: msal.telemetry: Generate or reuse correlation_id: ae87ec0b-3661-43c6-bd12-80290851f6de
DEBUG: cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/***/resourceGroups/***-functions/providers/Microsoft.Web/sites/***-identity-functions/syncfunctiontriggers?api-version=2022-03-01'
DEBUG: cli.azure.cli.core.sdk.policies: Request method: 'POST'
DEBUG: cli.azure.cli.core.sdk.policies: Request headers:
DEBUG: cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '40f952a8-5449-11ed-9542-6c9466047e4f'
DEBUG: cli.azure.cli.core.sdk.policies: 'CommandName': 'functionapp deployment source config-zip'
DEBUG: cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g -n --src --debug'
DEBUG: cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.41.0 (MSI) azsdk-python-azure-mgmt-web/7.0.0 Python/3.10.5 (Windows-10-10.0.19044-SP0)'
DEBUG: cli.azure.cli.core.sdk.policies: 'Authorization': ''
DEBUG: cli.azure.cli.core.sdk.policies: Request body:
DEBUG: cli.azure.cli.core.sdk.policies: This request has no body
DEBUG: urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
DEBUG: urllib3.connectionpool: https://management.azure.com:443 "POST /subscriptions/
/resourceGroups/
-functions/providers/Microsoft.Web/sites/**-identity-functions/syncfunctiontriggers?api-version=2022-03-01 HTTP/1.1" 400 346
DEBUG: cli.azure.cli.core.sdk.policies: Response status: 400
DEBUG: cli.azure.cli.core.sdk.policies: Response headers:
DEBUG: cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
DEBUG: cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Length': '346'
DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
DEBUG: cli.azure.cli.core.sdk.policies: 'Expires': '-1'
DEBUG: cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
DEBUG: cli.azure.cli.core.sdk.policies: 'Server': 'Microsoft-IIS/10.0'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-AspNet-Version': '4.0.30319'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-Powered-By': 'ASP.NET'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-writes': '1199'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '59a4ae66-0524-47ff-b224-eaf65a87711f'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '59a4ae66-0524-47ff-b224-eaf65a87711f'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'UKSOUTH:20221025T094208Z:59a4ae66-0524-47ff-b224-eaf65a87711f'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
DEBUG: cli.azure.cli.core.sdk.policies: 'Date': 'Tue, 25 Oct 2022 09:42:07 GMT'
DEBUG: cli.azure.cli.core.sdk.policies: Response content:
DEBUG: cli.azure.cli.core.sdk.policies: {"Code":"BadRequest","Message":"Encountered an error (ServiceUnavailable) from host runtime.","Target":null,"Details":[{"Message":"Encountered an error (ServiceUnavailable) from host runtime."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","Message":"Encountered an error (ServiceUnavailable) from host runtime."}}],"Innererror":null}
DEBUG: cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception:
DEBUG: cli.azure.cli.core.util: Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 663, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 697, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 333, in call
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 524, in enable_zip_deploy_functionapp
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 735, in upload_zip_to_storage
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 728, in upload_zip_to_storage
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/core/tracing/decorator.py", line 73, in wrapper_use_tracer
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/mgmt/web/v2022_03_01/operations/_web_apps_operations.py", line 48499, in sync_function_triggers
azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request'
Content: {"Code":"BadRequest","Message":"Encountered an error (ServiceUnavailable) from host runtime.","Target":null,"Details":[{"Message":"Encountered an error (ServiceUnavailable) from host runtime."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","Message":"Encountered an error (ServiceUnavailable) from host runtime."}}],"Innererror":null}

ERROR: cli.azure.cli.core.azclierror: Operation returned an invalid status 'Bad Request'
ERROR: az_command_data_logger: Operation returned an invalid status 'Bad Request'
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x04967B68>]
INFO: az_command_data_logger: exit code: 1
INFO: cli.main: Command ran in 17.878 seconds (init: 0.487, invoke: 17.391)
INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
INFO: telemetry.client: Accumulated 0 events. Flush the clients.
INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
INFO: telemetry.save: Save telemetry record of length 3185 in cache
INFO: telemetry.check: Returns Positive.
INFO: telemetry.main: Begin creating telemetry upload process.
INFO: telemetry.process: Creating upload process: "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry_init_.pyc C:\Users\jacob.azure"
INFO: telemetry.process: Return from creating process
INFO: telemetry.main: Finish creating telemetry upload process.

@Palving
Copy link
Author

Palving commented Oct 25, 2022

It's hard to tell where the issue lies, I however attempted calling the synctriggers api directly. https://management.azure.com/subscriptions/*********/resourceGroups/rgName/providers/Microsoft.Web/sites/functionApp/syncfunctiontriggers?api-version=2022-03-01.

It works for the first couple of calls, however after a while it starts to return 400, same as in the deployment, with the same error message as seen in the deployment logs.

I've also noted that the api-version differs from the Azure task, and the latest available, hard to say if it makes any difference.

@FabianBigler
Copy link

Any news here of how to fix this? We are having the same issue.

@Palving
Copy link
Author

Palving commented Nov 14, 2022

We ended up moving back to app services on windows with dedicated plans.

@ihordyrman
Copy link

I am facing the same problem with my new function.
Consumption plan, Linux.

@vienleidl
Copy link

Changed to B1, it works for me, it seems to only happen on the Linux Y1 Consumption (Serverless) plan.

@FinVamp1 FinVamp1 assigned FinVamp1 and unassigned nadesu Dec 7, 2022
@FinVamp1
Copy link
Contributor

FinVamp1 commented Dec 7, 2022

Hello, I will investigate and come back to this thread.

@vienleidl
Copy link

Hello, I will investigate and come back to this thread.

Thank you very much! And I've already tried to remove the app setting, it also works well Azure/functions-action#147 (comment)

@ihordyrman
Copy link

Don't know if it will help you, but In my case, the problem was caused because I tried to deploy it while the app was stopped.

@sangxxh
Copy link

sangxxh commented Feb 12, 2023

Changed to B1, it works for me, it seems to only happen on the Linux Y1 Consumption (Serverless) plan.

Have tried both Y1 and B1 Linux both don't work.
What worked for me was to choose Windows OS instead of Linux for the App Service Plan.

@pawel-zolty
Copy link

@FinVamp1 isn't it problem with this line in the log:

Value of WEBSITE_RUN_FROM_PACKAGE has been changed to https://dtpmdcfirstrefusaddevsa.blob.core.windows.net/azure-pipelines-deploy/package_1663846829501.zip?***

Run from package is not supported for linux azure functions on consumption app service plan.

@Palving
Copy link
Author

Palving commented Mar 8, 2023

It's actually required, according to documentation.
https://learn.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package

image

@TechWatching
Copy link

Same error for me. It seems to happen without any reason, without anything that has changed from our side. It's a big blocker, it prevents us from deploying updates to our functions.

@FinVamp1
Copy link
Contributor

FinVamp1 commented Mar 8, 2023

Hello, will investigate with priority today. The task deploys using WEBSITE_RUN_FROM_PACKAGE_URL by default for the Linux Consumption plan.

@pawel-zolty
Copy link

pawel-zolty commented Mar 8, 2023

@FinVamp1 does the task also override deploymentMethod parameter if set to zipDeploy as OP wrote? Can we deploy zipDeploy withot Website_Run_From_Package?

@Palving Are you sure? Here is shown that consumption linux functions support both run from package with URI and simple zip deploy.
image

Edit: Zip deploy for consumption linux function is supported only when performing remote build:

Linux function apps running in the Consumption plan don't have an SCM/Kudu site, which limits the deployment options. However, function apps on Linux running in the Consumption plan do support remote builds.

When to use it: External package URL is the only supported deployment method for Azure Functions running on Linux in the Consumption plan, if the user doesn't want a remote build to occur. When you update the package file that a function app references, you must manually sync triggers to tell Azure that your application has changed. When you change the contents of the package file and not the URL itself, you must also restart your function app manually.

@MarGraz
Copy link

MarGraz commented Sep 26, 2023

In our case, with .NET 6, Azure Function v4, Microsoft Identity, the problem was that we had a Function with a reference to the WebApp, used to access the DB Identity context (because we had the necessity to retrieve users when the function was running).
Locally it worked perfectly, but after this change the release process was always returning:

Syncing triggers for function app
##[error]Error: Failed to sync triggers for function app 'func-name-dev'. Error: BadRequest - Encountered an error (InternalServerError) from host runtime. (CODE: 400)

After spending a lot of time looking for a solution, we decided to remove the WebApp reference from the Function, and we created a library with a separated scaffolding (DB first). The release process started working again.

@richard-berg
Copy link

richard-berg commented Oct 12, 2023

Deploying a Python functions app (v4) from VSCode's built-in integration has started failing with the same error.

I tried removing the managed identity, per the above suggestions, but that did not help. Neither did removing the host.json file from the storage container (as advised in a different issue).

12:10:57 PM cantori-attendance: Resetting all workers for cantori-attendance.azurewebsites.net
12:10:57 PM cantori-attendance: Deployment successful. deployer = ms-azuretools-vscode deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
12:11:10 PM cantori-attendance: Syncing triggers...
12:11:23 PM cantori-attendance: Syncing triggers (Attempt 2/6)...
12:11:34 PM cantori-attendance: Syncing triggers (Attempt 3/6)...
12:11:54 PM cantori-attendance: Syncing triggers (Attempt 4/6)...
12:12:35 PM cantori-attendance: Syncing triggers (Attempt 5/6)...
12:13:55 PM cantori-attendance: Syncing triggers (Attempt 6/6)...
12:13:59 PM: Error: Encountered an error (InternalServerError) from host runtime.

I've been trying several times for the last hour. Same app deployed ok yesterday.

@code-simian
Copy link

We've changed the function from Linux to Windows and it instantly worked. This was without any other changes in our pipeline and configuration.

@richard-berg
Copy link

Unfortunately, it looks like Python functions are not supported on Windows.

@richard-berg
Copy link

Completely deleting the resource group, function app, storage, etc was still not enough. Something in the deployment framework is busted.

For help pinpointing, note that I was wrong about it working yesterday; last succesful deploy was actually October 9.

@FinVamp1
Copy link
Contributor

@richard-berg I've reproduced your issue and this is related to setting the TZ app setting which isn't supported on Linux Consumption SKU's this is only supported on dedicated and Elastic Premium SKU's. This is discussed at Azure/azure-functions-host#9203 . I'll be adding Checks to show this as a configuration issue in Diagnose and Solve,

@richard-berg
Copy link

Thanks @FinVamp1! I would've never figured that out from the (lack of) deployment logs alone.

I was able to get my app deployed, with the triggers reconfigured to UTC times. They'll be 1hr off during Daylight Savings, but that's better than not running at all.

@edonosotti
Copy link

Same problem here. It looks like this one is being open for over a year and it's a real big trouble.
I think the issue is at the platform level though, because I found it out while I was re-deploying a Function App because the function suddenly stopped working and no issues are being tracked in the internal metrics and logs. Bad stuff.

@tmakin
Copy link

tmakin commented Oct 27, 2023

Just hit this deploying a linux function app to consumption plan using the v2 release task in azure devops. I had removed a timer trigger from the function app and the new build failed with the "Failed to sync triggers" error. I was still able to deploy a previous build.

The fix for me was to delete all the AzureWebJobs.YourFunctionName.Disabled config settings relating to old triggers which had been superseded.

@lyadeski
Copy link

lyadeski commented Oct 30, 2023

Has anyone solved this? its been occurring on all our production deployments and our systems are completely offline and we are at a complete loss what to do right now.

8:43:13 PM PROD-XXX: Syncing triggers...
8:43:23 PM PROD-XXX: Syncing triggers (Attempt 2/6)...
8:43:34 PM PROD-XXX: Syncing triggers (Attempt 3/6)...
8:43:54 PM PROD-XXX: Syncing triggers (Attempt 4/6)...
8:44:35 PM PROD-XXX: Syncing triggers (Attempt 5/6)...
8:45:55 PM PROD-XXX: Syncing triggers (Attempt 6/6)...
8:45:56 PM: Error: Encountered an error (InternalServerError) from host runtime.

@code-simian
Copy link

@lyadeski have you tried switching the app host to Windows instead of Linux?

@lyadeski
Copy link

@lyadeski have you tried switching the app host to Windows instead of Linux?

i did but that introduces new issues. i dont understand what has changed, everything was working fine until a couple days ago, we've made no code changes or infrastructure changes and suddenly everything stops working - very frustrating

@hamdrew
Copy link

hamdrew commented Oct 31, 2023

I encountered this error when I had neglected to configure Azure Private Endpoint DNS. This prevented the Function App runtime from resolving the hostname of the Azure Storage private endpoint.

I had to open a support case with Microsoft to get to my solution. I highly recommend you do the same if you are encountering this error. They have additional views into the engine that can help pinpoint the issue.

@tr3ysmith
Copy link

Has anyone solved this? its been occurring on all our production deployments and our systems are completely offline and we are at a complete loss what to do right now.

8:43:13 PM PROD-XXX: Syncing triggers... 8:43:23 PM PROD-XXX: Syncing triggers (Attempt 2/6)... 8:43:34 PM PROD-XXX: Syncing triggers (Attempt 3/6)... 8:43:54 PM PROD-XXX: Syncing triggers (Attempt 4/6)... 8:44:35 PM PROD-XXX: Syncing triggers (Attempt 5/6)... 8:45:55 PM PROD-XXX: Syncing triggers (Attempt 6/6)... 8:45:56 PM: Error: Encountered an error (InternalServerError) from host runtime.

We had the exact same problem yesterday. Function App was completely down, couldn't redeploy, and I open a support ticket with Microsoft to only be told that I either needed to switch away from consumption plan, or implement a timer function to keep the app from going to cold start. Absolutely ridiculous answer to the problem... Sounds to me like theres a bug with the consumption plan currently, and no one wants to address it.

Our function app worked perfectly fine before the weekend, and we made no code changes or configuration changes, it just stopped working.

For now, I moved to the Premium plan, and its back working, but we're going to be looking into alternative options, since we can't have this happen again, and not get proper answers from the support team.

@FinVamp1
Copy link
Contributor

Hello all,

I'm Finbar and I'm part of the Functions engineering team at Microsoft and I work on the features related to Application Code Deployment.
As part of the Functions deployment logic we call SyncTriggers endpoint.
This makes sure that the Functions Runtime and the underlying infrastructure are up to date with the triggers in the Functions for this Function app.

This thread is long and so I will summarize the symptoms people get and the potential causes for each. If this update doesn't help you resolve the issue then please consider opening a support case or providing me with an app name and timeframe for when your issue occurs.

Summary of issues related to Sync Triggers

  1. The SyncTriggers call fails because the SSL certificate used by the app is self signed.
  2. The Sync Triggers call fails because the undrlying VM's are not available to take the SyncTriggers request.
  3. The app is on Linux Consumption and is using the TZ app setting or WEBSITE_TIME_ZONE setting. As indicated above this can cause the sync triggers call to fail.
  4. The SyncTriggers Hash is stored on the Storage account specified in AzureWebJobsStorage and if this is locked down via VNet restrictions or Private endpoints then updating the hash can fail.
  5. As mentioned above SyncTriggers can fail if the AzureWebJobs.YourFunctionName.Disabled config settings exist.

More Details
This issue was specific to issues with SyncTriggers when ran in the context of the AzureFunctionApp DevOps tasks. I see a number of people are seeing this error from other client tools. The troubleshooting of this error depends on the underlying status code from the Sync Trigger call.

  • 5xx generally means a server error
  • 4xx means something was wrong with the payload.

Investigating Sync Trigger issues

  1. Please start with the Diagnose and Solve Blade where we have a number of Detectors related to deployment and these should show Sync Trigger errors as well.

image

If this doesn't help then please contact Support or provide an app name and timeframe in this thread or email to me finbarr at microsoft.com

Next Steps from Microsoft

We understand that this error can be cryptic and we are looking at how best to resolve this in two areas.

  1. Improve the error messages when SyncTriggers fail
  2. Look at how best to recover and/or diagnose these issues for you to prevent these issues.

Thanks,

Finbar

@telmotrooper
Copy link

Here's what worked for me:

I was trying to zip deploy to a Linux/Node.js-based Function App. I had a working instance created through the Azure Portal and another created via a Bicep template where the ServiceUnavailable error would happen.

I've used the following commands to get the settings for each instance:

az resource show -g "RESOURCE_GROUP_NAME" --resource-type "Microsoft.Web/sites" -n "FUNCTION_APP_NAME_1"

az resource show -g "RESOURCE_GROUP_NAME" --resource-type "Microsoft.Web/sites" -n "FUNCTION_APP_NAME_2"

Diffing the outputs I noticed that my new function app was missing a definition for the linuxFxVersion setting, so I've updated my Bicep template to include that variable and assign the value NODE|18 to it. With that done I was finally able to perform a zip deploy to this instance.

Here's a part of the Bicep template for reference:


resource functionApp 'Microsoft.Web/sites@2022-09-01' = {
  name: functionAppName
  location: location
  kind: 'functionapp'
  properties: {
    serverFarmId: appServicePlan.id
    siteConfig: {
      appSettings: [
        {
          name: 'AzureWebJobsSecretStorageType'
          value: 'files'
        }
        {
          name: 'AzureWebJobsStorage'
          value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};AccountKey=${storageAccount.listKeys().keys[0].value};EndpointSuffix=core.windows.net'
        }
        {
          name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
          value: applicationInsights.properties.InstrumentationKey
        }
        {
          name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
          value: 'InstrumentationKey=${applicationInsights.properties.InstrumentationKey}'
        }
        {
          name: 'FUNCTIONS_WORKER_RUNTIME'
          value: 'node'
        }
        {
          name: 'FUNCTIONS_EXTENSION_VERSION'
          value: '~4'
        }
        {
          name: 'WEBSITE_RUN_FROM_PACKAGE'
          value: '1'
        }
      ]
      linuxFxVersion: 'NODE|18'
    }
  }
}

@ozkary
Copy link

ozkary commented Nov 7, 2023

I was getting the Syncing Triggers BadRequest error during the deployment. I am using Linux Y1 service plan. The runtime was set to 3.0. I swtiched to 4.0, and there were no more errors. You can access the runtime setting by visiting:

Configuration-> function runtime setting (tab)

  • Runtime 3.0 - Error
Deployment successful. deployer = Push-Deployer deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
Remote build succeeded!
Syncing triggers...
Syncing triggers...
Syncing triggers...
Syncing triggers...
Error calling sync triggers (BadRequest). Request ID = '31e425ca-7ce2-4856-b03d-b15771ce0f10'.
  • runtime 4.0 - OK
Remote build succeeded!
Syncing triggers...
Functions in fn*****:
    **** - [httpTrigger]
        Invoke url: https://***.azurewebsites.net/api/***

@jamalsoueidan
Copy link

jamalsoueidan commented Nov 12, 2023

For me the issue was related to the storage account, the keys in the azure function app setting wasn't correct and pointed to a deleted azure storage accounts, and the application needed that to deploy.

  1. I created new azure storage accounts, and update those connection string to the storage account.

Then it worked!

@jamalsoueidan
Copy link

jamalsoueidan commented Nov 12, 2023

Hello all,

I'm Finbar and I'm part of the Functions engineering team at Microsoft and I work on the features related to Application Code Deployment. As part of the Functions deployment logic we call SyncTriggers endpoint. This makes sure that the Functions Runtime and the underlying infrastructure are up to date with the triggers in the Functions for this Function app.
....

Please see my comment, the health check couldn't see that my settings had storage account that didn't exist.

@joskuijpers-imec
Copy link

We have found that we get this error when deployment throws an exception. E.g. when our (tirgger) configuration was wrong.
You can find this exception in the Log Stream during deployment. Fixing such exception fixed our deployment.

This is with dotnet-isolated runtime. This seems to be different behavior than we had before.

@VladislavsKugelevics
Copy link

VladislavsKugelevics commented Nov 27, 2023

We have found that we get this error when deployment throws an exception. E.g. when our (tirgger) configuration was wrong. You can find this exception in the Log Stream during deployment. Fixing such exception fixed our deployment.

This is with dotnet-isolated runtime. This seems to be different behavior than we had before.

Same for me. Also, log stream does not work, so I can't even find which exception do I have. This is infuriating ;-(
@joskuijpers-imec do you have any advice how to find out which exception is thrown or how to fix log stream?

@joskuijpers-imec
Copy link

@VladislavsKugelevics we only looked at the log stream, sorry to hear that doesn't work for you

@VladislavsKugelevics
Copy link

I have advice for anyone having the same issue. If you are not being able to see the error in log stream or application insights.

  • If you deploy to Windows, you can connect to console using Portal and check logs in the filesystem. To connect, use Function app menu, there is option for developer tools and console there. Logs are located several dirs above the function itself.
  • Make sure you checked entry in logs that starts with Handling WorkerErrorEvent.
    Query example: traces | where message contains "WorkerError" | order by timestamp desc

@captainhook
Copy link

We managed to switch the Linux App Service Plan from Y1 (Consumption) to B1 and it resolved it for us. It broke for us after adding AAD auth.

I understand this has been already posted as a solution working for some people and not others. Nevertheless this is the Az CLI we ran:

az login
az account set --subscription "[your sub name]"
az appservice plan update --name "[your app service plan name]" --resource-group "[resource group name for the app service plan]" --sku B1

If Microsoft divulges any info on why this is happening, I'll be sure to share with a follow up.

@nxp200
Copy link

nxp200 commented Dec 22, 2023

For others who may be struggling with this error message, I have run into this issue for the past 6 weeks and finally was able to identify what was causing it for my Function App. With all the correct configuration settings set up for vnet integration etc with the storage account, I was still experiencing incosistent deployment success/failures. After opening a ticket with Microsoft, they were able to look at back end logs - not visible to end users during deployment - and there was an error related to the Python packed named "typing". This was in the requirements.txt file we were trying to deploy but we were not aware that package comes default with Python and was not needed to be added. Removal of this package from the requirements.txt file fixed the issue completely and deployments have been 100% successful since.

"Why does this cause Syncing of Triggers to fail sometimes?" I am told by Microsoft support that it installs the package successfully, but after the function app restarts after deployment of code (successfully), it hits an error that prevents the restart from completing in time. Sometimes it progresses past the error fast enough and Syncing of Triggers is able to complete, and other times it doesn't.

"What could be done to help avoid or debug this issue?" Better error logging to the end users during deployment via VS Code deployment logs.

This is my understanding so far, so am happy to be corrected anywhere I may have mis-spoken. This is also likely an isolated incident with the "typing" package, but it might give clues for others out there regarding the requirements.txt file and packages being installed.

@hem-sharma
Copy link

I also encountered with this issue recently. But I found below issue in my situation:

  • I forgot to start the function app which I stopped earlier during testing, so function app was not running (stopped state),
  • I was trying to deploy net8.0 to a function app running with net7.0

It got worked for me after solving those.

Hope this might be helpful to anyone.

@FinVamp1 FinVamp1 added FunctionsTaskBacklog and removed environment:need-to-triage Issues need to be triage by environment-deployment team labels Feb 6, 2024
@MitchellMcKenna
Copy link

I ran into this issue because I had not compiled my custom handler for the correct runtime, for example we are using golang so we had to do:

GOOS=linux GOARCH=amd64 go build -o handler handler.go

Once i did that, sync triggers worked right away with func azure functionapp publish...

@JuulJuup
Copy link

JuulJuup commented Apr 9, 2024

We didn't specify the python version in our azure-pipelines.yml file. We fixed this issue by adding the following code in our build step:

    - task: UsePythonVersion@0
      inputs:
        versionSpec: '$(python.version)'
      displayName: 'Use Python $(python.version)'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests