I am experimenting with Spring Cloud Functions on top of Azure Functions, and while I was trying to run a sample project for azure functions I came across the following error.
Executed 'Functions.uppercase' (Failed, Id=4fd6ef4c-209c-45cb-bf65-ce38e90b6620)
System.Private.CoreLib: Exception while executing function: Functions.uppercase. System.Private.CoreLib: Result: Failure
Exception: ClassCastException: com.microsoft.azure.functions.worker.binding.RpcHttpRequestDataSource cannot be cast to java.lang.String
Stack: java.lang.ClassCastException: com.microsoft.azure.functions.worker.binding.RpcHttpRequestDataSource cannot be cast to java.lang.String
at com.microsoft.azure.functions.worker.binding.DataOperations.apply(DataOperations.java:91)
at com.microsoft.azure.functions.worker.binding.DataSource.computeByType(DataSource.java:56)
at com.microsoft.azure.functions.worker.binding.RpcHttpRequestDataSource.computeByType(RpcHttpRequestDataSource.java:20)
at com.microsoft.azure.functions.worker.binding.DataSource.computeByName(DataSource.java:42)
at com.microsoft.azure.functions.worker.binding.RpcHttpRequestDataSource.computeByName(RpcHttpRequestDataSource.java:20)
at com.microsoft.azure.functions.worker.binding.BindingDataStore.getDataByName(BindingDataStore.java:50)
at com.microsoft.azure.functions.worker.broker.ParameterResolver.resolve(ParameterResolver.java:59)
at com.microsoft.azure.functions.worker.broker.ParameterResolver.resolve(ParameterResolver.java:42)
at com.microsoft.azure.functions.worker.broker.JavaMethodExecutor.execute(JavaMethodExecutor.java:52)
at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:51)
at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33)
at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
.
Sample project link on github https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-samples/function-sample-azure
public class FooHandler extends AzureSpringBootRequestHandler<Foo, Bar> {
@FunctionName("uppercase")
public Bar execute(
@HttpTrigger(name = "req", methods = { HttpMethod.GET,
HttpMethod.POST }, authLevel = AuthorizationLevel.ANONYMOUS) Foo foo,
ExecutionContext context) {
return handleRequest(foo, context);
}
}
Azure local runtime version 2 (Fails in Azure as well)
Azure Functions Core Tools (2.3.199 Commit hash: fdf734b09806be822e7d946fe17928b419d8a289)
Function Runtime Version: 2.0.12246.0
As there's nothing related to Spring Cloud in the stack-trace, I suppose this is related to Azure. Would appreciate any help.
com.microsoft.azure.functions.worker.binding.RpcHttpRequestDataSource cannot be cast to java.lang.String
. – rickvdbosch