Payload too large
I am getting a payload too large error, directing me to this line:
const response = await api.post(operationRoute.path, superjsonArgs)
How can adjust the max payload size for uploads?
9 Replies
Hi @prof_mark. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. The knowledge sources provided do not contain information on how to adjust the max payload size for uploads in Wasp. I recommend checking the Wasp documentation or reaching out to the Wasp community for further assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @prof_mark, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
I've tried following the directions here: https://wasp-lang.dev/docs/advanced/middleware-config#default-middleware-definitions
I now have in my serverSetup.ts file:
but I now get an error:
Any ideas @kapa.ai
Let me check the knowledge base for you. One moment! :books:
----------------------
The error message indicates that the
setup
function is not being exported from your serverSetup.ts
file. The setup
function is required by Wasp and is expected to be exported from your server setup file.
In your serverSetup.ts
file, you should have something like this:
The setup
function is expected to be an async function and will be awaited before the server starts accepting any requests. It allows you to do any custom setup, e.g. setting up additional database/websockets or starting cron/scheduled jobs. You can read more about it in the Wasp documentation (https://wasp-lang.dev/docs/project/server-config#setupfn-extimport).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @prof_mark, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?this didnt work. i am giving up for now and hopefully someonw has an idea
Hey @prof_mark
You used a named export in serverSetup.ts, but imported it using a default import in wasp. You should either use a default export in both files, or a named export in both files.
With the code you showed here, the import in main.wasp must look like
import { serverMiddleWareFn } from '@src/serverSetup.ts
(notice the curly braces).
But more importantly, what are you uploading that exceeds the payload limit?Awesome thank you!
Wohooo @prof_mark, you just became a Waspeteer level 1!
Was trying to send a 512x512 base 64 encoded image to open AI for their vision model. So really just needed to pass through. Ended up switching to sending the URL since I'm uploading the images to s3 anyway
Ok, good choice!
Yeah, that's pretty big for a post request 😅