Azure / Azure/azure-functions-core-tools

Azure function is not detected locally in Java 11 Azure Core Tools 4

Open
#3,693 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
5d 4h
Merged PRs (30d)
15

Description

**Getting below error after running azure func locally -**
Azure Functions Core Tools
Core Tools Version: 4.0.5611 Commit hash: N/A +591b8aec842e333a87ea9e23ba390bb5effe0655 (64-bit)
Function Runtime Version: 4.31.1.22191

[2024-05-23T18:25:07.830Z] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
For detailed output, run func with --verbose flag.
[2024-05-23T18:25:12.703Z] Host lock lease acquired by instance ID '000000000000000000000000A10320D7'.

pom.xml
----------

4.0.0

com.capnova
RegisterHCP
0.1.0-SNAPSHOT
jar

Azure Java Functions


UTF-8
1.8
1.34.0
3.1.0
RegisterHCP-1716478336661



com.microsoft.azure.functions
azure-functions-java-library
${azure.functions.java.library.version}



org.junit.jupiter
junit-jupiter
5.4.2
test


org.mockito
mockito-core
2.23.4
test




org.apache.maven.plugins
maven-compiler-plugin
3.8.1

${java.version}
${java.version}
${project.build.sourceEncoding}



com.microsoft.azure
azure-functions-maven-plugin
${azure.functions.maven.plugin.version}


${functionAppName}

java-functions-group

java-functions-app-service-plan


westus







windows
8







FUNCTIONS_EXTENSION_VERSION
~3





package-functions

package






maven-clean-plugin
3.1.0



obj





HttpTriggerFunction.java
----------------------------

import com.microsoft.azure.functions.ExecutionContext;
import com.microsoft.azure.functions.HttpMethod;
import com.microsoft.azure.functions.HttpRequestMessage;
import com.microsoft.azure.functions.HttpResponseMessage;
import com.microsoft.azure.functions.HttpStatus;
import com.microsoft.azure.functions.annotation.AuthorizationLevel;
import com.microsoft.azure.functions.annotation.FunctionName;
import com.microsoft.azure.functions.annotation.HttpTrigger;

import java.util.Optional;

public class HttpTriggerFunction {
@FunctionName("echo")
public HttpResponseMessage echo(
@HttpTrigger(
name = "req",
methods = {HttpMethod.GET},
authLevel = AuthorizationLevel.ANONYMOUS)
HttpRequestMessage> request,
final ExecutionContext context) {
context.getLogger().info("Java HTTP trigger processed a request.");

// You can retrieve and use request body or query parameters if needed
String body = request.getBody().orElse("No content");

// Create and return an HTTP response
return request.createResponseBuilder(HttpStatus.OK)
.body("Hello")
.build();
}
}

host.json
---------
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
}
}

local.settings.json
-------------------
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "java"
}
}

Azure function built successfully and exists in expected hierarchy folders under target.

Contributor guide

Open the contributing guide

Research direction

Reproduce the report with Azure Functions Core Tools and its --verbose option, using the supplied pom.xml, HttpTriggerFunction.java, host.json, and local.settings.json. Check how the local project is built and discovered, then verify that the echo function is detected without the “No job functions found” message.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, java
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.