Skip to content

Azure Functions work Locally, but Timeout or Freeze when deployed on Azure #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ruyakubu opened this issue Jul 11, 2018 · 16 comments
Closed
Assignees

Comments

@ruyakubu
Copy link

Has anyone been able to successfully run deployed Java Azure Functions in Azure?

I find it odd that none of these published samples work Locally, but all fail and keep Timing out on the Azure portal:
https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-java-maven
https://github.com/Microsoft/function-demo-java-on-azure

What's missing?

@pragnagopa
Copy link
Member

can you please share function app name and approximate time when you saw timeouts?

@brunoborges
Copy link
Member

@pragnagopa
Copy link
Member

the sample is using old version of library which is not supported any more https://github.com/Microsoft/function-demo-java-on-azure/blob/master/walkthrough/pom.xml#L24
Will submit a PR to fix the sample.

@ruyakubu
Copy link
Author

Which version works?

I am using version 1.10.

  1. Here's my repo:
    https://github.com/ruyakubu/helloJavaAzureFunction

  2. Here's my maven archetype:
    mvn archetype:generate -DarchetypeVersion=1.10 ^
    -DarchetypeGroupId=com.microsoft.azure ^
    -DarchetypeArtifactId=azure-functions-archetype

  3. Here's the deployment azure link to show the Timeouts:
    https://hello-function-20180711170135136.azurewebsites.net/api/hello?name=HelloWorld

@pragnagopa
Copy link
Member

You are using old sdk which is not supported any more

<dependency>
            <groupId>com.microsoft.azure</groupId>
            <artifactId>azure-functions-java-core</artifactId>
            <version>1.0.0-beta-3</version>
</dependency>

Latest maven archetype should work. You do not have to specify a version.

cc: @jdneo

@ruyakubu
Copy link
Author

what about the archetypeVersion=1.10? Is that incorrect too?

@pragnagopa
Copy link
Member

Yes. Just use the latest using command

mvn archetype:generate ^
    -DarchetypeGroupId=com.microsoft.azure ^
    -DarchetypeArtifactId=azure-functions-archetype

@ruyakubu
Copy link
Author

We already established 1 month ago when I spoke to you that the archetype you just provide DID NOT WORK. It was causing the local functions to fail/freeze. That's when you and Bruno advised me to use version 1.10, which got the function to work locally.

Next, if you look in my Hello repo link I sent you, I clearly using version 1.0.0-beta-3 for the azure-function-java-core in my POM.xml:
https://github.com/ruyakubu/helloJavaAzureFunction/blob/master/pom.xml

So, we are going in circles because all of these dependency versions should be handled in the archetype.

@pragnagopa
Copy link
Member

We made several fixes after that. We were in the middle of making breaking changes then. So we asked you to use version of archetype.

@ruyakubu
Copy link
Author

Using the maven archetype without specifying the version gives my the following error when I try to deploy to Azure:

[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.test.functions:test-functions >------------------
[INFO] Building Azure Java Functions 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- azure-functions-maven-plugin:1.0.0-beta-2:deploy (default-cli) @ test-functions ---
AI: INFO 12-07-2018 09:09, 1: Configuration file has been successfully found as resource
AI: INFO 12-07-2018 09:09, 1: Configuration file has been successfully found as resource
[INFO] Starting deploying to Azure Functions test-functions-20180712090403798...
[INFO] Authenticate with Azure CLI 2.0
[INFO] Updating Azure Functions...
[INFO] Successfully updated Azure Functions test-functions-20180712090403798
[INFO]
[INFO] Step 1 of 4: Creating ZIP package...
[INFO] Successfully saved ZIP package at C:\mypath\test-functions\target\azure-functions\test-functions-20180712090403798.zip
[ERROR] Application setting 'AzureWebJobsStorage' not found.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.656 s
[INFO] Finished at: 2018-07-12T09:09:45-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.0.0-beta-2:deploy (default-cli) on project test-functions: Application setting 'AzureWebJobsStorage' not found. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

@pragnagopa
Copy link
Member

@ruyakubu - Your sample is still using old sdk. Please see here for the updated sample https://github.com/pragnagopa/function-demo-java-on-azure

@jdneo - Any ideas on deploy error?

@ruyakubu
Copy link
Author

Can you list step by step what steps a developer is supposed to follow?

  1. You advised me use an archetype w/o the version that generates the java Function + POM.xml. I tried that and the azure deploy fails to deploy and has ERRORS (shown above)

  2. At what point do we use the maven archetype; and at what point do we manually override everything that the archetype automatically generates?

  3. Before I go on another wild goose hunt, can you git my Hello repo in your local environment and get it to successfully DEPLOY and RUN in the cloud, before you advised me to use another setting that does not work? I think it makes more sense for you to use my exact code and replicate the error before you diagnose suggest another solution.

  4. Going in circles in this thread is not helping. Start w/ my broken code, then point out a true solution

@pragnagopa
Copy link
Member

FYI @brunoborges @selvasingh @asavaritayal
I submitted a PR with the fix to your sample code ruyakubu/helloJavaAzureFunction#1

I was able to repro the deploy issue. Root cause is resource group name is not unique. Opened issue
microsoft/azure-maven-plugins#242

@jdneo
Copy link
Contributor

jdneo commented Jul 13, 2018

@ruyakubu

I see an error goes: [ERROR] Application setting 'AzureWebJobsStorage' not found.

Could you please check the Application settings of the Function App that AzureWebJobsStorage is not empty?

you can find this in Azure Portal:
image

@pragnagopa
Copy link
Member

Closing this as this is fixed.
@jdneo - Please see microsoft/azure-maven-plugins#242 for root cause.

cajuncoding added a commit to cajuncoding/ApacheFOP.Serverless that referenced this issue Mar 4, 2021
…optimizations. Bumped all versions of all dependencies to the latest stable versions. Bumped Apache FOP to latest v2.6 just released in Jan. 2021. Fixed some possible deployment issues due to AppName and ResourceName needing to be unique (as noted in Azure/azure-functions-java-worker#140). And incremented SNAPSHOT to v1.1 to denote the big changes/improvements that have now been completed.

***NOTE: Deployments to Azure were still failing however until the Java Version was updated to 11 in the Runtime Settings of the Azure App in the portal; which then took some time ~5 minutes (environment change I suppose) and finally the deployed application was able to run successfully after deployment, with all the latest changes!
@wkarratoon
Copy link

Kind of more related to jdneo's comment above but empty settings can also occur when you use --force on deploy to switch the FUNCTIONS_WORKER_RUNTIME of your function app, in my case to node. When I did so I first got a 503 waiting for a response.

After some head-banging, I was then clued by comments here for this issue to check my own app settings and indeed found no value was selected for Node.js Version in Stack Settings. Picking a version resolved the issue.

So use --force with caution. Microsoft could also enhance documentation guidance here and set default elections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants