【问题标题】:Deploy a Azure function using Azure DevOps (Python 3.7) - Error 500使用 Azure DevOps (Python 3.7) 部署 Azure 函数 - 错误 500
【发布时间】:2020-05-06 11:38:23
【问题描述】:

我已遵循此文档:https://docs.microsoft.com/bs-latn-ba/azure/azure-functions/functions-how-to-azure-devops,但在调用该函数时出现500 Internal Server Error。但是,使用 VSCode 我可以使用相同的代码部署它。此错误解释了函数如何找不到导入的库。

GitHub结构目录:

app-functions/rt-function/HTTPTrigger
app-functions/rt-function/HTTPTriggerStable
app-functions/rt-function/requirements.txt

CI:

  1. 使用 Python 3.7
  2. 内嵌内容的 Bash 脚本:

    cd ./app-functions/rt-function/ 如果 [ -f extensions.csproj ] 然后 dotnet build extensions.csproj --output ./bin 菲 pip install --target="./.python_packages/lib/site-packages" -r ./requirements.txt

  3. 归档 app-functions/rt-function、要归档的根文件夹或文件:app-functions/rt-function 和要创建的归档文件:$(System.DefaultWorkingDirectory)/build$(Build.BuildId)。拉链

  4. 发布工件:drop,发布路径:$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip

【问题讨论】:

  • 我猜dotnet build生成的部署文件放错地方了。您可以访问https://yourAppName.scm.azurewebsites.net 以检查应用程序文件是否部署在正确的文件夹结构中。您还可以比较通过 VSCode 部署到 azure 应用服务器的文件夹结构和通过 Azure devops 管道部署的文件夹结构。这样你就会看到差异。
  • 问题是 python_packages 文件必须位于的文件夹目录。现在一切都很好,谢谢你的提问。

标签: azure deployment azure-devops azure-functions


【解决方案1】:

为了让其他人看到答案,我总结了评论中分享的答案:

此问题的根本原因是文件夹结构不正确

参考:

类似问题here

Folder structure

【讨论】:

    猜你喜欢
    • 2019-08-12
    • 1970-01-01
    • 1970-01-01
    • 2021-01-12
    • 1970-01-01
    • 2023-03-16
    • 1970-01-01
    • 2020-03-24
    • 1970-01-01
    相关资源
    最近更新 更多