Next.js Discord

Discord Forum

500 error when streaming big files via route handler

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
I'm calling the azure blob storage to download a file then stream it to the client. it works fine for files that are 60mb for example. I tried it with a file that was 1gb and i just get a 500 error on the client with no error messages.

If anyone has any ideas it would be appreciated.

    const data = await blobService.download();

    return new NextResponse(data.readableStreamBody, {
        status: 200,
        headers: {
            "Content-Type": "application/octet-stream",
            "Content-Disposition": `attachment; filename=${content.contentData}`,
            "Content-Length": data.contentLength.toString(),
        },
    });

0 Replies