Next.js Discord

Discord Forum

MaxBodySize config didnt work on nextjs 14

Unanswered
Noronha posted this in #help-forum
Open in Discord
I tried this config in prod:

/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    serverActions: {
      bodySizeLimit: '50mb',
    },
  },
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'lh3.googleusercontent.com',
        pathname: '**',
      },
    ],
  },
};

module.exports = nextConfig;


But it didnt work in prod (using vercel).
Nextjs version 14.1.2

I've done it like in the docs
https://nextjs.org/docs/app/api-reference/next-config-js/serverActions

Any help?

22 Replies

Fire ant
Do you want to upload file?
Yes, it's for fileupload.
Fire ant
Vercel max size limit is 5mb
it's a vercel issue then ohhh... Is there a way to increase that?
Fire ant
What plan do u use?
currently free.
Fire ant
Im on hobby plan
Yea, u cant change
They limit to 5mb
I'm going to upgrade to pro then... 20 bucks a month
@Noronha I'm going to upgrade to pro then... 20 bucks a month
Fire ant
If it can increase the size limit then its good
Its not clear about the limits =/
In the FAQ there's this URL:
https://vercel.com/docs/platform/limits
But didn't see anything about the 5mb body size limit.
Other solution is you can try use chunk upload
I'm using s3 in the server action (on the server) because I dont want to expose my keys. I'm using a public bucket, so I dont have signed urls or anything like that. I dont really want to upload in chunks 😦 I think I'll generate an URL and make the client-component upload directly to S3. What do you think?
Fire ant
I dont really upload big file using Vercel platform, for me personally i use my own vps server to setup what i need, because on Vercel (and other platform) you are strictly limited to server request body it can handle(4mb)
The best way for me, use vps....its all under your control. I could upload files up to 20gb.