-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
Created a Linux App Service plan, using:
"kind": "linux",
"sku": {
"capabilities": null,
"capacity": 1,
"family": "B",
"locations": null,
"name": "B3",
"size": "B3",
"skuCapacity": null,
"tier": "Basic"
},Having set some variables, created a Web App using:
az webapp create --name "$app_name" `
--resource-group "$resource_group" `
--plan "$plan" `
--runtime "python:3.11" `
--startup-file startup.txtAttempted to deploy the web app using:
az webapp deploy --name $app_name `
--resource-group $resource_group `
--src-path ./app.zip `
--clean
The build fails, since the Python code in app.zip includes one or more subdirectories. After some investigation on the App Service Plan, the deployment process tries to create directories with a backslash. This does not work on Linux. The result is that
routes/some_route.py
becomes
routes\some_route.py
which is a single file on Linux. The routes directory is not created. If all subdirectories are removed, the deployment works. If one or more subdirectories are included, Kudu fails to create them and the deployment crashes. Kudu appears to be using a non-portable mechanism for creating directories that may work on Windows but does not work on Linux.
Related command
az webapp deploy
Errors
2025-02-13T22:43:07 Clean deploying to /home/site/wwwroot
2025-02-13T22:43:07 Generating deployment script.
2025-02-13T22:43:07 Using cached version of deployment script (command: 'azure -y --no-dot-deployment -r "/tmp/zipdeploy/extracted" -o "/home/site/deployments/tools" --basic --sitePath "/tmp/zipdeploy/extracted"').
2025-02-13T22:43:07 Running deployment command...
2025-02-13T22:43:07 Command: "/home/site/deployments/tools/deploy.sh"
2025-02-13T22:43:07 Handling Basic Web Site deployment.
2025-02-13T22:43:07 Kudu sync from: '/tmp/zipdeploy/extracted' to: '/home/site/wwwroot'
2025-02-13T22:43:07 Copying file: 'DigiCertGlobalRootCA.crt.pem'
2025-02-13T22:43:07 Copying file: 'data\Directions.csv'
2025-02-13T22:43:07 Copying file: 'dbutils.py'
2025-02-13T22:43:07 Copying file: 'fileutils.py'
2025-02-13T22:43:07 Copying file: 'models.py'
2025-02-13T22:43:07 Error: EINVAL: invalid argument, open '/home/site/wwwroot/data\Directions.csv'
2025-02-13T22:43:07 An error has occurred during web site deployment.
2025-02-13T22:43:07 Kudu Sync failed
The error message is collected by tailing the Web App log during the deployment process.
Issue script & Debug output
Too much sensitive information.
Expected behavior
The web app should deploy correctly, such that the directories that are within the .zip file are created on the App Service Plan.
Environment Summary
azure-cli 2.69.0 *
core 2.69.0 *
telemetry 1.1.0
Extensions:
application-insights 1.2.2
Dependencies:
msal 1.31.2b1
azure-mgmt-resource 23.1.1
Additional context
When the web app is run locally or using Docker, it works as normal. It is possible to deploy it to the Linux App Service Plan using a Docker image, whereas the zip deployment fails as noted in this bug report.