microsoft / microsoft/azure-tools-for-java
Spring Boot context is not loaded properly when using Azure Toolkit for IntelliJ Run/Debug function
@Flanker32 is already working on this.
Since Sep 1, 2022.
- Dominant language
- Java
- Stars
- 262
- Forks
- 185
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 1
Description
How to reproduce:
- Check out https://github.com/Azure-Samples/hello-spring-function-azure and use Azure Toolkit for IntelliJ 3.67.0.
- Open the project
hello-spring-function-azurein IntelliJ IDEA 2022.2.1 (Ultimate Edition) - Run (or debug) the functions locally like it is explained here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-maven-intellij#run-the-project-locally
- Trigger the function like it is explained in the console output.
Now you see a failing request with following stack trace:
[2022-08-30T13:09:02.916Z] Executed 'Functions.hello' (Failed, Id=ca3f6824-5a29-45ce-a020-ac970d89cc8c, Duration=724ms)
[2022-08-30T13:09:02.916Z] System.Private.CoreLib: Exception while executing function: Functions.hello. System.Private.CoreLib: Result: Failure
[2022-08-30T13:09:02.916Z] Exception: NullPointerException:
[2022-08-30T13:09:02.916Z] Stack: java.lang.reflect.InvocationTargetException
[2022-08-30T13:09:02.916Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2022-08-30T13:09:02.916Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[2022-08-30T13:09:02.916Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2022-08-30T13:09:02.916Z] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[2022-08-30T13:09:02.916Z] at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:22)
[2022-08-30T13:09:02.916Z] at com.microsoft.azure.functions.worker.broker.EnhancedJavaMethodExecutorImpl.execute(EnhancedJavaMethodExecutorImpl.java:55)
[2022-08-30T13:09:02.916Z] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:61)
[2022-08-30T13:09:02.916Z] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33)
[2022-08-30T13:09:02.916Z] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
[2022-08-30T13:09:02.916Z] at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
[2022-08-30T13:09:02.916Z] at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
[2022-08-30T13:09:02.916Z] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[2022-08-30T13:09:02.916Z] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[2022-08-30T13:09:02.916Z] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[2022-08-30T13:09:02.916Z] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[2022-08-30T13:09:02.916Z] at java.base/java.lang.Thread.run(Thread.java:829)
[2022-08-30T13:09:02.916Z] Caused by: java.lang.NullPointerException
[2022-08-30T13:09:02.916Z] at org.springframework.cloud.function.adapter.azure.FunctionInvoker.handleRequest(FunctionInvoker.java:129)
[2022-08-30T13:09:02.916Z] at com.example.HelloHandler.execute(HelloHandler.java:27)
[2022-08-30T13:09:02.916Z] ... 16 more
[2022-08-30T13:09:02.916Z] .
[2022-08-30T13:09:04.714Z] Host lock lease acquired by instance ID '00000000000000000000000020ED4466'.
Expected behavior:
The function invocation works the same way as if I would use the azure function maven plugin azure-functions-maven-plugin:run goal
Some additional information:
Azure Functions Core Tools
Core Tools Version: 4.0.4736 Commit hash: N/A (64-bit)
Function Runtime Version: 4.8.1.18957
Please ask if I can supply more information!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.