Azure / Azure-Functions

1.12k stars 199 forks source link

Deploying Java Azure Functions with zip deployment #1280

Open acheung123 opened 5 years ago

acheung123 commented 5 years ago

Our team currently is able to properly deploy Azure Functions using Maven with the Azure Functions Plugin.

mvn clean package azure-functions:deploy "-DfunctionAppName=my-test-app" "-DfunctionAppRegion=centralus" "-DfunctionResourceGroup=my-test-rg"

We have tried exploring using zip deploys with both the Azure CLI and the zip deploy endpoint but with no success.

mvn clean package "-DfunctionAppName=my-test-app" "-DfunctionAppRegion=centralus" "-DfunctionResourceGroup=my-test-rg"
cd target/azure-functions/
zip -r my-test-app.zip my-test-app/
az functionapp deployment source config-zip -g my-test-rg -n my-test-app --src my-test-app.zip
mvn clean package "-DfunctionAppName=my-test-app" "-DfunctionAppRegion=centralus" "-DfunctionResourceGroup=my-test-rg"
cd target/azure-functions/
zip -r my-test-app.zip my-test-app/
curl -X POST -u "$my-test-app" https://my-test-app.scm.azurewebsites.net/api/zipdeploy -T my-test-app.zip

In both cases, I have confirmed the zip files were correctly uploaded to the Azure Function by downloading the app content after the zip deployments. From what I can see, the downloaded zip has the exact same files as the Maven Azure Functions Plugin deployment, but when we deploy with the zip methods the functions do not show up in Azure. Is there a deployment step we are missing?

ColbyTresness commented 5 years ago

@kulkarnisonia16

RFHold commented 4 years ago

Was a solution ever found for this?

ilanRosenbaum commented 4 years ago

I have the same exact issue was any solution ever found?

RFHold commented 4 years ago

I have the same exact issue was any solution ever found?

I had a combination of the bin folder included in the zip (delete it) and my function was not set to run in Java mode for new environments.

ilanRosenbaum commented 4 years ago

I have the same exact issue was any solution ever found?

I had a combination of the bin folder included in the zip (delete it) and my function was not set to run in Java mode for new environments.

My functions are nodejs, is what you're saying to basically delete the package-lock.json, package.json, and node_modules? Sorry if thats wrong I don't entirely know what you mean.

RFHold commented 4 years ago

I have the same exact issue was any solution ever found?

I had a combination of the bin folder included in the zip (delete it) and my function was not set to run in Java mode for new environments.

My functions are nodejs, is what you're saying to basically delete the package-lock.json, package.json, and node_modules? Sorry if thats wrong I don't entirely know what you mean.

I doubt that would be the solution. I have no experience with the nodeJS functions, sorry

RFHold commented 4 years ago

My functions are nodejs, is what you're saying to basically delete the package-lock.json, package.json, and node_modules? Sorry if thats wrong I don't entirely know what you mean.

have you made sure that your FUNCTIONS_WORKER_RUNTIME is set correctly?

ilanRosenbaum commented 4 years ago

Solved my issue by using func azure functionapp publish $App --javascript --force instead of zip deployment

RFHold commented 4 years ago

Solved my issue by using func azure functionapp publish $App --javascript --force instead of zip deployment

something similar would fix mine for Java and after that, zip deployment worked. I believe that the publish command sets that for you

pacon-vib commented 4 years ago

I think

cd target/azure-functions/
zip -r my-test-app.zip my-test-app/

should be

cd target/azure-functions/my-test-app/
zip -r my-test-app.zip .
farhanghouri commented 3 years ago

I think

cd target/azure-functions/
zip -r my-test-app.zip my-test-app/

should be

cd target/azure-functions/my-test-app/
zip -r my-test-app.zip .

Yes, this approach is working for me. Thanks!