Download Facebook 3.2.1 Handler.jar

0 views
Skip to first unread message
Message has been deleted

Brie Hoffler

unread,
Jul 14, 2024, 3:26:08 AM7/14/24
to martasurviou

Hello!
I'm trying to deploy an executable JAR file, which contains a Jetty server onto Azure functions. Locally, I can run my application with the command java -jar handler.jar. As far as I understand, in order to deploy it to Azure Functions, I need to use a custom handler -- for example, with the following host.json file, everything works fine locally when I run func start:
... "customHandler": { "description": "defaultExecutablePath": "/usr/bin/java", "arguments": ["-jar", "handler.jar"] , "enableForwardingHttpRequest": true ...
Now, I am wondering if there is any way to deploy this application to the Azure cloud, which is more efficient than creating a custom image? My handler.jar is very small (a couple of MB), while the base "slim" java image mcr.microsoft.com/azure-functions/java:4-java11-slim has almost 1GB. I tried out this approach and it works, but it seems to me it introduces a lot of overhead (build image, push very large image to dockerhub, ...). If I create a function with java as the runtime stack, and try to push this application to the cloud, I get the message Your Azure Function App has 'FUNCTIONS_WORKER_RUNTIME' set to 'java' while your local project is set to 'custom'.
So the question is: is there a way to use the provided Java runtime stack, and use it to execute my .jar file, or do I necessarily need to create an new image?
Thank you!

Hi @Takahito Iwasa ,
Thank you for your answer. Let me give you some more detail - probably I did not explain myself clear enough.
I am trying to replicate the example that is in "Quickstart: Create a Go or Rust function". I set up a couple of methods that respond to REST requests, and I bundeled them as well as a Jetty server, that manages and routes the requests, into the JAR. When I run java -jar handler.jar, an instance of a Jetty server is started, so I can navigate to :8080/ping. I can achieve the same when using func start with the following host.json:

Download Facebook 3.2.1 Handler.jar


DOWNLOAD https://urlcod.com/2yLZJz



So func will start a functions host that will redirect all its HTTP requests to the my server. This solution uses the JRE I have installed on my computer.
Now, I would like to deploy this app to Azure Functions. One possible way would be to create a custom image with the following Dockerfile:

and start a function by using this image - I tried this and it works ok. I was just wondering, if there is a way to avoid this step? For example, push only the JAR and all the .json files to functions and use the default JRE, that is included when I create a Function App with the Java runtime stack, in a similar way as func start?
Thank you!

EAS build using eas build -p android fails due to a gradle error and it seems to be related to @react-native-async-storage/async-storage and com.facebook.react.module.annotations. Building using expo build works fine though. Any ideas?

Maybe there was something wrong with your node_modules which was somehow fixed by you changing the version number and rerunning yarn/npm. If that is what happened then you could probably have fixed it by removing node_modules and reinstalling your dependencies.

7fc3f7cf58
Reply all
Reply to author
Forward
0 new messages