Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Function deployed successfully, but not working

I am facing a weird problem. I deployed my code using Azure DevOps Pipeline Release - it ran successfully, however, the code is not reflecting in Azure Function App.

Here is what I am doing:

  1. Created a Release pipeline with a "Deploy Azure App Service" task. It picks up artifacts from a build pipeline and is configured to deploy to a Function App using Service Connection
  2. When the Release pipeline is triggered it runs through all its steps, and I get a success (see logs below)
  3. However, when I open up Azure portal and navigate to the Function App, it continues to say "Now it is time to add your code" on the Overview tab, and I am not able to hit my API on that Function App
  4. Surprisingly, On the Deployment Center tab of the Function App, it does show the details of the deployment (See details below)
  5. I can also find the deployed zip file under D:\home\site\wwwroot when I log on to the Kudu console

Deployment logs:

Got service connection details for Azure App Service:'myFuncApp'
Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
Updated App Service Application settings and Kudu Application settings.
Package deployment using ZIP Deploy initiated.
Successfully deployed web package to App Service.
App Service Application URL: http://myFuncApp.azurewebsites.net

View on Function App Deployment Center Tab:

Deployed Successfully to production
 Source Version 6d9c8340ba  Build 20190411.1  Release: 3

The Function App endpoint is working, (throwing a generic welcome page) confirming the Function App itself is healthy, but I am not able to access my API.

Additional updates Here is the structure of the .zip file that is being uploaded to d:\home\data\SitePackages as a part of the zip deploy from Azure Pipelines:

/host.json
/package.json
/proxies.json
/package-lock.json
/func_name/index.js
/func_name/function.json
/node_modules/**

The same code is working locally.

Note: When I go to the Deployment Center tab, I do see this error message, but I think this is related to Continuous deployment through Function App

We were unable to connect to the Azure Pipeline that is connected to this Web App. This could mean it has been removed from the Azure Dev Ops Portal. If this has happened, you can disconnect this pipeline and set up a new deployment pipeline.

Please help me. What can be going wrong?

like image 385
TechiRik Avatar asked Feb 03 '23 19:02

TechiRik


1 Answers

I was finally able to troubleshoot. @4c74356b41 pointed me in the right direction as the key issue was the package.

Below was the issue:

  • I had added an archive step in the build pipeline. This was causing the artifact to be zipped before publish
  • In the release pipeline I was using Azure App Service Deploy task. This internally uses Zip Deploy where App type is set to Azure Functions. Thus, it was zipping my zipped file.

When I remove the archive step, the double zipping was avoided, and it started working.

like image 125
TechiRik Avatar answered Apr 02 '23 11:04

TechiRik