413 (Payload Too Large)
Unanswered
Broad-snouted Caiman posted this in #help-forum
Broad-snouted CaimanOP
experimental: {
serverActions: {
bodySizeLimit:"10mb"
},
// ppr:true,
},
even through I have next.conifg.js modified like this - I am still getting this error in production(file size is not more than 10mb)14 Replies
is your app hosting on vercel or self hosting?
Broad-snouted CaimanOP
vercel
how large is the file?
the body size contain all the form field you are posting
Broad-snouted CaimanOP
Actually it might be more than 10mb because I am passing 2 images instead of 1
let me re-check
I remembered that I was passing only 1
Broad-snouted CaimanOP
@Ray Still getting same error on 15mb size, images are not over 15mb
can you show the code of your server action?
Broad-snouted CaimanOP
export const generateEdit = async (data:FormData, prompt: string,) => {
console.log('aeee')
try {
const response = await openai.images.edit({
image: data.get('main') as File,
prompt: prompt,
mask: data.get('mask') as File,
model: "dall-e-2",
n: 4,
response_format: "b64_json",
size: "1024x1024"
})
return response.data
} catch (e) {
throw new Error(e as string)
}
}
Broad-snouted CaimanOP
maybe they disabled that feature because of Vercel Blob?
i think the 413 is return from openai
try this
export const generateEdit = async (data:FormData, prompt: string,) => {
console.log('aeee')
try {
const response = await openai.images.edit({
image: await (data.get('main') as File).arrayBuffer(),
prompt: prompt,
mask: await (data.get('mask') as File).arrayBuffer(),
model: "dall-e-2",
n: 4,
response_format: "b64_json",
size: "1024x1024"
})
return response.data
} catch (e) {
throw new Error(e as string)
}
}
Checkered Giant
Hey, I've also got an issue with server actions payload being too large. I added the config setting as suggested above but all files result in the error. Any ideas on potential solutions? The request is a fetch API call. More context: I'm uploading an audio file and sending the buffer data to openAI whisper. I'm not intending on storing the files.