Next.js Discord

Discord Forum

Change request body size for route handlers

Unanswered
Scale parasitoid posted this in #help-forum
Open in Discord
Scale parasitoidOP
I am trying to return form data from a request and send is a response from an API route, but there seams to be a limit of 1 MB for parsing the request body. Is there any way to change this another amount?

Dependencies:
"next": "^13.5.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",

app/api/process/route.ts:

export async function POST(req: Request) {
    try {
        // Get the data from formData
        const formData = await req.formData();

        // Send the data as a response
        return Response.json({
            data: formData
        });
    } catch (error) {
        return Response.error();
    }
}

Anyone found a solution or workaround for this?

0 Replies