Azure / Azure/azure-functions-nodejs-library

Throwing an error while HTTP streaming is enabled causes response to never be sent

Open
#324 1 comment 1 reaction 0 assignees View on GitHub
area:nodejs-functions
Dominant language
TypeScript
Stars
70
Forks
35
Avg merge
4d 18h
Merged PRs (30d)
6

Description

## Description

When HTTP streaming is enabled with `app.setup({ enableHttpStream: true })`, throwing any error causes the the response to never be sent and never logging anything.

## Expected behavior

Throwing an error causes a response with status 500 to be sent and the error to be logged, same as when HTTP streaming is disabled.

## Reproduction

```ts
import {
app,
type HttpRequest,
type InvocationContext,
type HttpResponseInit,
} from "@azure/functions";

app.setup({ enableHttpStream: true });

app.http("proxy", {
methods: ["POST"],
handler: proxy,
});

export async function proxy(
request: HttpRequest,
context: InvocationContext
): Promise {
throw new Error("Kaboom! 💣");
}
```

Setting `enableHttpStream: false` results in the expected behavior, but then streaming won't work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.