Skip to content

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

@nimobeeren

Description

@nimobeeren

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

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<HttpResponseInit> {
  throw new Error("Kaboom! 💣");
}

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions