I have a Azure Web App with NodeJS Runtime. I am using the following command to deploy published zip files.
az webapp deploy --resource-group test-rg --name AppName001 --src-path C:\path\to\publish.zip --type zip
It works fine when I create a zip using windows explorer. However, when I create a zip file through the following powershell command, the deployment fails.
Compress-Archive -Path "c:\path\to\bin\Release\*" -DestinationPath "c:\path\to\publish.zip" -Force
When I access the deployment logs in the Azure portal, I see the following (clipped version).
An error has occurred during web site deployment.
Rsync failed in 135 seconds, Error: rsync: [receiver] open "/home/site/wwwroot/node_modules\.bin
ode-which.ps1" failed: Invalid argument (22)
rsync: [receiver] open "/home/site/wwwroot/node_modules\@eslint-community\eslint-utils\index.d.mts" failed: Invalid argument (22)
rsync: [receiver] open "/home/site/wwwroot/node_modules\@eslint-community\eslint-utils\index.mjs.map" failed: Invalid argument (22)
rsync: [receiver] open "/home/site/wwwroot/node_modules\@eslint-community\eslint-utils
node_modules\eslint-visitor-keys\lib\visitor-keys.js" failed: Invalid argument (22)
rsync: [receiver] open "/home/site/wwwroot/node_modules\@eslint-community\regexpp\LICENSE" failed: Invalid argument (22)
rsync: [receiver] open "/home/site/wwwroot/node_modules\@eslint\config-helpers\dist\cjs\index.cjs" failed: Invalid argument (22)
rsync: [receiver] open "/home/site/wwwroot/node_modules\@eslint-community\eslint-utils\README.md" failed: Invalid argument (22)
What am I missing?
If you're using Windows Powershell 5.1, this answer - https://superuser.com/a/1382853 - suggests there’s an issue with old versions of dotnet framework using \ in paths in the internal zip directory so it doesn't unzip correctly on Linux (it treats the backslash as part of a filename rather than a path separator).
This seems likely given the mix of \ and / in the paths in your error message - for example:
rsync: [receiver] open "/home/site/wwwroot/node_modules\@eslint-community\eslint-utils\index.d.mts" failed: Invalid argument (22)
Try using Powershell (Core) 7+ instead and it might fix your problem.