Skip to content

How to change limit? API response for ${req.url} exceeds 4MB. This will cause the request to fail in a future version. #33162

Description

@700software

What version of Next.js are you using?

11.1.0

How are you deploying your application?

Other platform

Describe the Bug

When streaming a large file in an API response, are getting this warnings on the terminal.

(this change was first introduced in PR #26831 and modified to 4mb in #26887)

API response for /api/... exceeds 4MB. This will cause the request to fail in a future version. https://nextjs.org/docs/messages/api-routes-body-size-limit

But we are not using Vercel. We are not using AWS serverless functions at all. So to throw a warning is not relevant to us.

I am concerned that we will update Next.js and our file downloads will start throwing runtime exceptions in production as wording of #26831

In a future version this scenario will throw an error.

Possible solution(s)

I propose a config option to suppress this warning (future error) for non-Vercel users of Next.js.

Alternatively, I'm wondering if middleware would make this a non-issue?

We are hoping to avoid spinning up a custom server, but will do if required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions