Describe the bug
Say you deploy a Quarkus app to Azure Functions (using mvn azure-functions:deploy or mvn azure-functions:run). Later you want to interact with any of your endpoints. You get a ClassCastException (see Actual Behavior section)
Expected behavior
Being able to interact with the REST endpoint
Actual behavior
[2/2/2020 5:34:45 AM] Executed 'Functions.quarkus' (Failed, Id=5b062e90-b8e1-463c-bd7b-d7fa412acddd)
[2/2/2020 5:34:45 AM] System.Private.CoreLib: Exception while executing function: Functions.quarkus. System.Private.CoreLib: Result: Failure
Exception: ClassCastException: Cannot convert com.microsoft.azure.functions.worker.binding.RpcHttpRequestDataSource@4f5c16a2to type com.microsoft.azure.functions.HttpRequestMessage<java.util.Optional<byte[]>>
Stack: java.lang.ClassCastException: Cannot convert com.microsoft.azure.functions.worker.binding.RpcHttpRequestDataSource@4f5c16a2to type com.microsoft.azure.functions.HttpRequestMessage<java.util.Optional<byte[]>>
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.binding.DataOperations.generalAssignment(DataOperations.java:191)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.binding.DataOperations.apply(DataOperations.java:120)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.binding.DataSource.computeByType(DataSource.java:56)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.binding.RpcHttpRequestDataSource.computeByType(RpcHttpRequestDataSource.java:20)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.binding.DataSource.computeByName(DataSource.java:42)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.binding.RpcHttpRequestDataSource.computeByName(RpcHttpRequestDataSource.java:20)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.binding.BindingDataStore.getDataByName(BindingDataStore.java:55)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.broker.ParameterResolver.resolve(ParameterResolver.java:59)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.broker.ParameterResolver.resolve(ParameterResolver.java:42)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.broker.JavaMethodExecutor.execute(JavaMethodExecutor.java:52) [2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:53)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
[2/2/2020 5:34:45 AM] at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
[2/2/2020 5:34:45 AM] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2/2/2020 5:34:45 AM] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2/2/2020 5:34:45 AM] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2/2/2020 5:34:45 AM] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2/2/2020 5:34:45 AM] at java.lang.Thread.run(Thread.java:748)
[2/2/2020 5:34:45 AM] .
To Reproduce
Steps to reproduce the behavior:
mvn azure-functions:runConfiguration
# Add your application.properties here, if applicable.
Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):
uname -a or ver: Microsoft Windows [Version 10.0.18363.628]java -version:OpenJDK Runtime Environment (Zulu 8.40.0.25-CA-win64) (build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (Zulu 8.40.0.25-CA-win64) (build 25.222-b10, mixed mode)Additional context
(Add any other context about the problem here.)
Our current solution is to override the following parts of BaseFunction.java in our project code:
Notice the change from Optional


@carlitorendon's solution worked for me too!
@patriot1burke do you know if this is still an issue?
I'll take a look, I never tried azure-functions:run. I just did azure-functiosn:deploy and hit azure with a client.
@clarlitorendon @tehMalone
Guys, maybe you have a custom function.json? The dataType must be "binary"
{
"scriptFile" : "../${project.build.finalName}-runner.jar",
"entryPoint" : "io.quarkus.azure.functions.resteasy.runtime.Function.run",
"bindings" : [ {
"type" : "httpTrigger",
"direction" : "in",
"name" : "req",
"route" : "{*path}",
"methods" : [ "GET", "POST", "HEAD", "PUT", "OPTIONS", "DELETE" ],
"dataType" : "binary",
"authLevel" : "ANONYMOUS"
}, {
"type" : "http",
"direction" : "out",
"name" : "$return"
} ]
}