Azure / Azure/azure-functions-host
Function appears to execute with no errors, but externally appears to fails
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 37
Description
I am trying to call a function with an HttpTrigger from Postman (and/or Fiddler). The function executes with no errors, but in Postman, I only see a 500.
#### Investigative information
Please provide the following:
- Function App version (1.0 or 2.0-beta): 2.0-beta
- Environment: local
- Microsoft.NET.Sdk.Functions: 1.0.13
#### Repro steps
1. Create a function with the following:
```csharp
[FunctionName("PostList")]
public static async Task Post(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "lists")]HttpRequest req,
TraceWriter log)
{
try
{
return new CreatedAtRouteResult(new { id = 1 }, null);
}
catch(Exception e)
{
return new BadRequestResult();
}
}
```
2. Set a breakpoint at both return statements
3. Run with debugging
4. Using Postman (or Fiddler), execute a POST on "http://localhost:7071/api/lists"
5. The first breakpoint is hit, second is not
#### Expected behavior
Upon finishing execution of the function, Postman should receive a 200.
#### Actual behavior
Postman receives a 500 instead.
#### Related information
* Programming language used: C#
Contributor guide
Research direction
Reproduce the issue locally with the supplied C# HttpTrigger, debugger breakpoints, and POST request to http://localhost:7071/api/lists. Start by tracing the response handling after CreatedAtRouteResult is returned; done means the function completes without an error and Postman receives the expected successful response instead of HTTP 500.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100