File Size Limit With App Router
Answered
Common Goldeneye posted this in #help-forum
Common GoldeneyeOP
Currently building an app which required large files to be uploaded
Im using the app router and next 14
Error:
https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
has no reference to the size limit config in current versions
Im using the app router and next 14
export async function POST(request: Request) {
const buffer = Buffer.from(await file.arrayBuffer());
... }
export const config = {
api: {
bodyParser: {
sizeLimit: "100mb",
},
},
};Error:
export const config in .../route.ts is deprecated. https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
has no reference to the size limit config in current versions
6 Replies
@Common Goldeneye Currently building an app which required large files to be uploaded
Im using the app router and next 14
ts
export async function POST(request: Request) {
const buffer = Buffer.from(await file.arrayBuffer());
... }
export const config = {
api: {
bodyParser: {
sizeLimit: "100mb",
},
},
};
Error: `export const config` in .../route.ts is deprecated.
https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
has no reference to the size limit config in current versions
change the limit like this in
next.config.js/** @type {import('next').NextConfig} */
module.exports = {
experimental: {
serverActions: {
bodySizeLimit: '100mb',
},
},
}@Ray change the limit like this in `next.config.js`
ts
/** @type {import('next').NextConfig} */
module.exports = {
experimental: {
serverActions: {
bodySizeLimit: '100mb',
},
},
}
Common GoldeneyeOP
Did that, still had the issue
Common GoldeneyeOP
turns out it was the nginx proxy I had ontop of it
Answer
Common GoldeneyeOP
lmfao
cloudflare, nginx and next all fighting over who can limit my file size