Azure功能已成功部署,但无法正常工作

问题描述 投票:1回答:1

我面临着一个奇怪的问题。我使用Azure DevOps Pipeline Release部署了我的代码 - 它成功运行,但是代码没有反映在Azure Function App中。

这是我在做的事情:

  1. 使用“部署Azure应用服务”任务创建了一个Release管道。它从构建管道中获取工件,并配置为使用服务连接部署到功能应用程序
  2. 当Release管道被触发时,它会执行所有步骤,并且我获得了成功(请参阅下面的日志)
  3. 但是,当我打开Azure门户并导航到功能应用程序时,它会继续在“概述”选项卡上说“现在是时候添加代码了”,我无法在该功能应用程序上点击我的API
  4. 令人惊讶的是,在功能应用程序的“部署中心”选项卡上,它确实显示了部署的详细信息(请参阅下面的详细信息)
  5. 当我登录到Kudu控制台时,我还可以在D:\home\site\wwwroot下找到已部署的zip文件

部署日志:

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

查看功能应用程序部署中心选项卡:

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

功能应用程序端点正在工作,(抛出一个通用的欢迎页面)确认功能应用程序本身是健康的,但我无法访问我的API。

其他更新以下是.zip文件的结构,该文件作为Azure管道的zip部署的一部分上载到d:\home\data\SitePackages

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

相同的代码在本地工作。

注意:当我转到Deployment Center选项卡时,我确实看到了此错误消息,但我认为这与通过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.

请帮我。什么可能出错?

azure-devops azure-functions azure-pipelines azure-pipelines-release-pipeline
1个回答
2
投票

我终于能够排除故障了。 @ 4c74356b41指出我正确的方向,因为关键问题是包。

以下是问题:

  • 我在构建管道中添加了一个归档步骤。这导致在发布之前压缩工件
  • 在发布管道中,我使用的是Azure App Service Deploy任务。这内部使用Zip Deploy,其中App type设置为Azure Functions。因此,它正在压缩我的压缩文件。

当我删除存档步骤时,避免了双重压缩,它开始工作。

© www.soinside.com 2019 - 2024. All rights reserved.