I just wrote a new function with java runtime 17. Locally, I am able to run the azure function but the deployment is giving "No HTTP triggers found.". This started happening today. It was working till yesterday. Not sure what has changed for java on jan 31st 2024.
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
}
}
Deployment:
10:29:46 PM njs123: c:\trunk\jj\build\tmp\jar\MANIFEST.MF
10:29:46 PM njs123: c:\trunk\jj\build\azure-functions\jj-1706844397343\host.json
10:29:46 PM njs123: c:\trunk\jj\build\azure-functions\jj-1706844397343\local.settings.json
10:29:46 PM njs123: c:\trunk\jj\build\azure-functions\jj-1706844397343\HttpTriggerJava1\function.json
10:29:46 PM njs123: c:\trunk\jj\build\azure-functions\jj-1706844397343\jj-1.0-SNAPSHOT.jar
10:29:46 PM njs123: c:\trunk\jj\build\azure-functions\jj-1706844397343\lib\azure-functions-java-core-library-1.0.0.jar
10:29:46 PM njs123: c:\trunk\jj\build\libs\jj-1.0-SNAPSHOT.jar
10:29:46 PM njs123: c:\trunk\jj\build\classes\java\main\com\fun
Code:
import java.util.*;
import com.microsoft.azure.functions.annotation.*;
import com.microsoft.azure.functions.*;
public class HttpTriggerJava1 {
@FunctionName("HttpTriggerJava1")
public HttpResponseMessage run(
@HttpTrigger(name = "req", methods = {HttpMethod.GET,
HttpMethod.POST}, authLevel = AuthorizationLevel.FUNCTION)
HttpRequestMessage<Optional<String>> request,
final ExecutionContext context) {
context.getLogger().info("Java HTTP trigger processed a
request.");
String query = request.getQueryParameters().get("name");
String name = request.getBody().orElse(query);
if (name == null) {
return
request.createResponseBuilder(HttpStatus.BAD_REQUEST).body("Please
pass a name on the query string or in the request body").build();
} else {
return
request.createResponseBuilder(HttpStatus.OK).body("Hello, " +
name).build();
}
}
}
I was facing the same issue while deploying Java Http Triggered Azure function using Visual Studio code.
To resolve this, I have downgraded Azure Functions Extension version to 1.13.1 in
Visual Studio Code=>Extensions=> Search for Azure Functions=>click on drop down of Uninstall->select Install other version=>select 1.13.1 version.Local response:
Portal:
Response: