What's the maximum payload entity size in wasp?
I'm getting PayloadTooLargeError: request entity too large errors if I pass JSON files into a create action. I've been experimenting a bit and it seems like it's around 100kb, is there any way to increase that? Or is it by design
3 Replies
Hi @CamBlackwood. 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 provided knowledge sources do not specify a maximum payload entity size in Wasp or how to increase it. However, Wasp does use superjson (https://github.com/blitz-js/superjson) under the hood, which allows you to send and receive any superjson-compatible payload, including JSON files.
If you're encountering a
PayloadTooLargeError
, it might be related to the specific configuration of your server or the superjson library, rather than a limitation of Wasp itself. I would recommend checking the documentation or support resources for your server framework or the superjson library for more information on handling large payloads.
For more details on how Wasp handles actions and payloads, you can check the Wasp documentation (https://wasp-lang.dev/docs/data-model/operations/actions#implementing-actions-in-node).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @CamBlackwood, 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 guess the easiest way to do that would be to customise the
json
middleware: https://wasp-lang.dev/docs/advanced/middleware-config
You can do smth like express.json({ limit: '200mb' })
- https://expressjs.com/en/api.html#express.jsonConfiguring Middleware | Wasp
Wasp comes with a minimal set of useful Express middleware in every application. While this is good for most users, we realize some may wish to add, modify, or remove some of these choices both globally, or on a per-api/path basis.
cool thanks @miho , I'll give that a go!