projectkudu / kudu

Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.
Apache License 2.0
3.12k stars 655 forks source link

ZIP deployment instructions are missing required Content-Type when WEBSITE_RUN_FROM_PACKAGE=1 #3470

Closed cbodin closed 5 months ago

cbodin commented 1 year ago

POST:ing to /api/zipdeploy with a .zip file as per the documentation on an Azure Web App Linux with WEBSITE_RUN_FROM_PACKAGE=1 causes a 500 Internal Server error. https://github.com/projectkudu/kudu/wiki/REST-API#zip-deployment https://github.com/projectkudu/kudu/wiki/Deploying-from-a-zip-file-or-url

The azure-cli sets a Content-Type: application/octet-stream header when performing the zip deploy resulting in a successful deploy. https://github.com/Azure/azure-cli/blob/b88d627d0d681d97639df452c47266a31ed6f3b0/src/azure-cli/azure/cli/command_modules/appservice/custom.py#L595-L600C74

Proposed changes to the wiki on both of those pages:

curl -X POST \
     -H "Content-Type: application/octet-stream" \
     -u '<username>:<password>' \
     -T "<zip-package-path>" \
     "https://<app-name>.scm.azurewebsites.net/api/zipdeploy"
curl -X PUT \
     -H "Content-Type: application/json" \
     -u '<username>:<password>' \
     -d '{"packageUri": "<zipUrl>"}' \
     "https://<app-name>.scm.azurewebsites.net/api/zipdeploy"

I've also opened an issue to get this fixed in the azure-docs repo: https://github.com/MicrosoftDocs/azure-docs/pull/111803

jvano commented 5 months ago

Hi

If the problem persists and is related to running it on Azure App Service, please open a support incident in Azure: https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request

This way we can better track and assist you on this case

Thanks,

Joaquin Vano Azure App Service