0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Next.js】ServerActionsのリクエストボティの最大サイズを設定する方法

Posted at

デフォルトの最大サイズは1MB

ServerActionsのリクエストの最大サイズはデフォルトでは1MBとなっています。
1MBを超過すると以下のようなエラーとなります。

 ⨯ uncaughtException: [Error: Body exceeded 1 MB limit.
                To configure the body size limit for Server Actions, see: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit] {
  statusCode: 413
}

最大サイズを設定する

任意のサイズに変更するにはnext.config.jsに次の設定を追記します。

/** @type {import('next').NextConfig} */
 
module.exports = {
  experimental: {
    serverActions: {
      bodySizeLimit: '3mb',
    },
  },
}

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?