Azure Function template is invoked but never responds

Di Rienzo, Francesco 5 Reputation points
2023-05-02T16:17:31.64+00:00

Hello, Thanks a lot in advance, I have followed this guide (https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-java) to create an azure function in VS Code using Java and Maven.

the code is the following:

User's image

the host.json is the following:
User's image

the local.settings.json is the following:

User's image

then I am able to start the azure function locally with:

mvn azure-functions:run -f "c:\Users\francesco.di.rienzo\Desktop\Azure f1\pom.xml".

and the output in the terminal is the following:

Functions:

        HttpExample: [GET,POST] http://localhost:7071/api/HttpExample

For detailed output, run func with --verbose flag.
[2023-05-02T16:09:12.497Z] Worker process started and initialized.
[2023-05-02T16:09:15.362Z] Host lock lease acquired by instance ID '000000000000000000000000F10D2648'.

but when I copy that link in the browser I don't see anything, the page just keeps loading, but in the terminal, in VS Code, I can see that there is a new log:
Executing 'Functions.HttpExample' (Reason='This function was programmatically called via the host APIs.', Id=5aadbadf-3198-4532-8fdb-f704637233b3)

and that's it.

When I run mvn test -f "c:\Users\francesco.di.rienzo\Desktop\Azure f1\pom.xml" I can see in the terminal that those two loggers are printed:

context.getLogger().info("HELLOOOOOOOOOOOOOOOOOOOOOOOOOo");

context.getLogger().info("Java HTTP trigger processed a request.");
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,571 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Lohith Goudagere Nagaraj 0 Reputation points Microsoft Employee
    2023-05-03T01:49:42.1266667+00:00

    when you pasted the link in the browser, did you paste it as "http://localhost:7071/api/HttpExample" or as "http://localhost:7071/api/HttpExample?name=Azure" ??

    According to your code - you are looking for either a querystring property called name or data in body. if you dont pass anything your code should through bad request exception.

    trying passing the name querystring property and check.