Closed yortch closed 3 weeks ago
As a temporary workaround I ended up using a postdeploy
script: https://github.com/yortch/protobuf-function/blob/main/azure.yaml#L16 which effectively deploys the function using this command:
func azure functionapp publish $env:AZURE_FUNCTION_NAME
I still would like confirmation as to whether this is supported, to determine if I'm doing something incorrectly or this is a defect.
@yortch Thanks for reporting this. When Java support was introduced over a year ago, support was added for ACA + App Service but not Functions. The behavior you're seeing is unfortunately the default behavior of deploying the packaged artifact, which happens to be app.jar without host.json included.
If azd could automatically figure out the staging directory used in mvn package
, or perhaps just let the user specify it directly in azure.yaml
as dist
, and zip the directory that includes host.json
, app.jar
, I could see this working without too much effort.
Thank you @weikanglim for the input. The documentation lists both Azure Functions and Java as supported features, so I assumed this combination was supported: [https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/supported-languages-environments]
It does seem like every other azd
operation supports Azure Java Functions, except for the package (and deploy) steps. I tried on a separate repo to provide a dist
path which included a zip file with the necessary files to deploy the function, unfortunately I got this error:
ERROR: failed packaging service 'fn-quarkus': no java archive files (.jar, .ear, .war) found in C:\Users\jbalderas\source\repos\fn-quarkus\target\dist
I also tried renaming this zip file as a jar file, and azd deploy
published the file successfully, but it assumes it is the Java code jar file and does not upload the required function.zip file. I would assume most developers are using the azure-functions-maven-plugin
to develop Azure Functions in Java, so it would be ideal if the deploy
step would take the output from target\azure-functions\function-name
when deploying the function.
@yortch, there's a private build in the linked PR (install instructions here) that uses target/azure-functions/<functionAppName>
by default in deploying functions if you'd like to give it a try. You can also point the dist
path at a custom staging directory, if needed.
Output from
azd version
Runazd version
and copy and paste the output here:azd version 1.9.5 (commit cd2b7af9995d358aab33c782614f801ac1997dde)
Describe the bug When deploying Azure Function using
azd deploy
(orazd up
), the Azure function is created successfully (usinginfra/terraform
), but the function is not actually deployed. When reviewing the files uploaded, I only see a file named app.jar, without thehost..json
, or any of the dependent libraries needed for the app to function. It appears thatazd deploy
is uploading the output ofazd package
which is a single jar, even thoughazd package
appears to go through the correct steps to package the required files for the azure function.See
azd output
:To Reproduce
azd
branch:git checkout azd
azd up
Expected behavior I expect the function to be deployed successfully with the HTTP Trigger binding.
Environment Information on your environment:
Additional context Issue appears to be incorrect output from
azd package
, assuming this is supported