Server Action Body Size Limit does not apply in production environment #77505
|
I have a server action that uploads a file to an OCI Object Storage. /** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
optimizePackageImports: ['@chakra-ui/react'],
serverActions: {
bodySizeLimit: 100 * 1024 * 1024,
}
},
reactStrictMode: true,
};
export default nextConfig;But i still have the following log in my application I am at a loss of what to do. For instance, this is my Dockerfile And this is my package.json {
"name": "vschat",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack --port 3001",
"dev-debug": "next dev --port 3001",
"prebuild": "prisma generate",
"build": "next build",
"start": "next start",
"lint": "next lint",
"check": "tsc --noEmit"
},
"dependencies": {
"@chakra-ui/react": "^3.13.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.13.0",
"@hookform/resolvers": "^3.9.0",
"@mui/icons-material": "^6.1.1",
"@mui/lab": "^6.0.0-beta.16",
"@mui/material": "^6.4.4",
"@mui/system": "^6.4.7",
"@prisma/client": "^6.4.1",
"@stomp/stompjs": "^7.0.0",
"@tanstack/react-query": "^5.67.3",
"@tanstack/react-table": "^8.21.2",
"@zag-js/file-upload": "^1.2.1",
"@zag-js/file-utils": "^1.2.1",
"axios": "^1.7.9",
"dayjs": "^1.11.13",
"firebase": "^10.13.2",
"firebase-admin": "^13.2.0",
"fuse.js": "^7.0.0",
"js-cookie": "^3.0.5",
"lucide-react": "^0.475.0",
"next": "^15.2.2",
"next-themes": "^0.4.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-hook-form": "^7.53.0",
"react-icons": "^5.5.0",
"react-markdown": "^9.0.1",
"react-syntax-highlighter": "^15.6.1",
"react-use": "^17.6.0",
"remark-gfm": "^4.0.0",
"wavesurfer.js": "^7.9.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@chakra-ui/cli": "^3.13.0",
"@types/js-cookie": "^3.0.6",
"@types/node": "^20",
"@types/react": "19.0.10",
"@types/react-dom": "19.0.4",
"@types/react-syntax-highlighter": "^15.5.13",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.57.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-next": "15.1.7",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"husky": "^9.1.7",
"prisma": "^6.4.1",
"typescript": "^5"
},
"overrides": {
"@types/react": "19.0.10",
"@types/react-dom": "19.0.4"
}
}I'd love to receive some help in this matter. |
Replies: 8 comments 8 replies
|
Does that action pass? We have a similar issue, but from the opposite side. We have set a limit, yet despite this limit, the server action goes through, and this error serves more as a log. |
|
Hi @renato-viasoft, Did you get it working ? But still have same error message on production |
|
We ran into the same issue for our deployed Docker container. But when we used |
|
Hi, I’m facing the same issue even after applying the recommended configuration from the official Next.js documentation. The 1 MB body size limit still persists in the production environment, despite setting the bodySizeLimit parameter to 30 MB in the next.config.js file. Has anyone been able to identify the cause of this behavior or found a workaround? Thanks in advance for the help! |
|
Did anyone find an answer for that issue? Facing the same at the moment. Set the Limit to 10 MB but when I build the docker container for production I get the error of 1 MB |
|
Set bodySizeLimit: "70MB" and COPY next.config.(js|ts) fix for me |
|
@mauro-serrano-f amazing!! bodySizeLimit setting 10MB is worked, setting 10mb not be working, but offical document example is 'mb' |
|
Does anybody have any updates on this? |
Hello, I was able to resolve the issue by updating my Dockerfile. Since I am self-hosting (not using Vercel) and using the standalone output, I cannot use the next start command.
Here is my complete working Dockerfile: