I want to upload a file via server event handler but seems like that this is not working? My external API throws me 413 payload to large but outside of nuxt it works fine without any issues. What did I wrong? Here is my code:
// CLIENT SIDE
const formData = new FormData();
formData.append("file", file);
const res = await $fetch(`/api/storage/upload`, {
method: "post",
body: formData,
headers: {
"Content-Type": "multipart/form-data",
}
});
// SERVER SIDE /api/storage/upload
export default defineEventHandler(async (event) => {
const client = myExternalClientAPI(event);
const data = await readBody(event) // should contain form data
const res = await client.storage.uploadImage(data); // throws me a 413 payload to large but works outside of nuxt3
return res;
});