简体   繁体   中英

Deploy a Azure function using Azure DevOps (Python 3.7) - Error 500

I have followed this documentation: https://docs.microsoft.com/bs-latn-ba/azure/azure-functions/functions-how-to-azure-devops but I get a 500 Internal Server Error when I invoke the function. However, using VSCode I could deploy it using the same code. This error explains how the function can not find the imported libs.

GitHub structure directory:

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

CI:

  1. Use Python 3.7
  2. Bash Script with inline content:

    cd./app-functions/rt-function/ if [ -f extensions.csproj ] then dotnet build extensions.csproj --output./bin fi pip install --target="./.python_packages/lib/site-packages" -r./requirements.txt

  3. Archive app-functions/rt-function, Root folder or file to archive:app-functions/rt-function and Archive file to create:$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip

  4. Publish Artifact: drop, Path to publish: $(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip

To make the answer visible to others, I'm summarizing the answer shared in comment:

The root cause for this issue is that folder structure was incorrect .

Reference:

An similar issue here .

Folder structure

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM