Skip to content

nextjs api routes not excepting body more than 1MB #52457

@manjunath-nuveb

Description

@manjunath-nuveb

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:44 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T8103
    Binaries:
      Node: 18.16.0
      npm: 9.8.0
      Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.4.10-canary.0
      eslint-config-next: 12.3.4
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 4.9.5
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://codesandbox.io/s/next-with-api-forked-6cs9k8?file=/pages/api/test.js

To Reproduce

Use the link https://codesandbox.io/s/next-with-api-forked-6cs9k8?file=/pages/api/test.js to reproduce

Describe the Bug

I am trying to build a react image uploader application with nextjs api routes.

API is throwing error whenever the request body size is more than 1MB

tried the following config, still not working
export const config = { api: { bodyParser: { sizeLimit: "25mb", }, }, }

Expected Behavior

API should be able to handle any request body size

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions