0
votes

I am trying to deploy my azure function (python) from VS code and it's giving the below error.

I was able to debug my code in my local machine without any error, and I am not understanding why deployment is failing.

11:55:51 PM nhtsacleanse: Detecting platforms...
11:55:51 PM nhtsacleanse: Error: Oops... An unexpected error has occurred.
11:55:53 PM nhtsacleanse: /opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.7 -p packagedir=.python_packages/lib/site-packages
11:55:57 PM nhtsacleanse: Deployment failed.

enter image description here

Created azure function app in azure portal

enter image description here

enter image description here

enter image description here

1
Sometimes deploy function by extension may show unexpected error. Could you please have a try with create the function app first on azure portal and then use this command func azure functionapp publish <functionAppName> --build remote in VS code to deploy your function from local to azure. - Hury Shen

1 Answers

0
votes

According to my experience, deploy function by clicking the button in VS code sometimes may occur unexpected error message. You can deploy your function by using command func azure functionapp publish <functionAppName> --build remote instead.

Before run the command in your VS code, you need to create a function app first on azure portal. Please choose python 3.7 like below screenshot show when you create the function app on portal(to avoid version issue) because it seems your local python function is 3.7. Then run the command in "Terminal" window of your VS code to deploy the code from local to azure. I usually use this deployment method and always works fine.

enter image description here