karatemanjohnson
karatemanjohnson15mo ago

Increasing Body 1mb limit

Hey, Im trying to build an application that allows sending of base64 encoded files to my next.js server through TRPC. I read online that the only currently supported way to do that is by base64 encoding and then shipping it over through JSON. Is there a way to increase the default 1mb limit on post requests? For my purposes 2-4MB would be more than enough But i am expecting a few at > 1mb filesize.
4 Replies
Nick
Nick15mo ago
That limit will likely be from whatever web server is hosting your tRPC api This isn’t really the best way to send files around though, you can end up essentially DDOS’ing yourself Right now the best production ready way is to use a file host and have the frontend upload or download from that, the API just generates secure links We do have an experimental Form Data implementation but it’s going to change a lot
karatemanjohnson
karatemanjohnson15mo ago
gotcha, so if i'm using next/js the issue is somewhere withing my next/js config, not TRPC this also isnt for production more for a hackathon style project. Its not going to be hosted. I just have a few files over 1mb that I'd like to be able to upload
Nick
Nick15mo ago
GitHub
trpc/examples/.experimental/next-formdata at main · trpc/trpc
🧙‍♀️ Move Fast and Break Nothing. End-to-end typesafe APIs made easy. - trpc/examples/.experimental/next-formdata at main · trpc/trpc
Nick
Nick15mo ago
This might help, though it’s not any more documented than that right now