JetBrains/azure-tools-for-intellij

Azure Function deployment fails with WEBSITE_RUN_FROM_PACKAGE setting

vjraitila opened this issue · 5 comments

The Rider plugin fails to deploy to a Function App configured to use WEBSITE_RUN_FROM_PACKAGE. This setting is the default for e.g. the Azure Functions extension within VS Code.

STEPS TO REPRODUCE

  1. Provision a Function App in Azure (Consumption, .NET 6, Linux)
  2. Generate a (Azure Functions) project within VS Code with an HttpTrigger
  3. Deploy the project from VS Code
  4. Open the same project in Rider
  5. Attempt to deploy the project from Rider

EXPECTED RESULTS

The project is successfully deployed.

ACTUAL RESULTS

Rider fails to deploy with a non-helpful error message.

...
Publishing ZIP file. Attempt 1 of 3...
Publishing ZIP file. Attempt 2 of 3...
Publishing ZIP file. Attempt 3 of 3...
Fail publishing ZIP file. Response code: 409. Response message: Conflict.
Fail publishing ZIP file: java.lang.RuntimeException: Fail publishing ZIP file. Response code: 409. Response message: Conflict.
Fail publishing ZIP file

The API unfortunately does not give anything more than a 409 Conflict message, which can be for various reasons.

Can you just deploy from Rider without the WEBSITE_RUN_FROM_PACKAGE setting?

If I drop the WEBSITE_RUN_FROM_PACKAGE setting from app configuration, and clean up the function-releases container from the storage account, the deployment from Rider will obviously succeed.

But what if I want to run the function app from a package?

Rider uses zip deployment, other options are not supported

They are not mutually exclusive. Having an app run from a package still relies on zip deploy.

Encountered similar issue with (almost) same conditions.
When deploying to Azure functions on Linux (.net 8), consumer plan, rider deployment stops the functions app - which, in turn, results in "broken-pipe" error during deployment.
Verbose output from AZ CLI deployment indicates that a related sub-tool reports error 401 during deployment - might be caused by same whacky error code.
Build #RD-241.14494.325, built on April 16, 2024
And one more thing - AZ CLI docs indicate, that linux/consumption are "special" - they don't have kudu, so the deployment package path must be configured after deployment (https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-functions/run-functions-from-deployment-package.md#benefits-of-running-from-a-package-file , see the consumption/os table) - hopefuly could be useful to fixing the issue