Next.js Discord

Discord Forum

Dynamic config for API route

Answered
Ashy Storm-Petrel posted this in #help-forum
Open in Discord
Ashy Storm-PetrelOP
Hi everyone, I want to config the max size for the request payload via an env variable in .env file (Access at runtime, not build time). I know this does not work, but have anyone had a way to work around? Thank you so much.
Answered by ᴉuɐpɹɐɐ
vercel already has a payload hard limit of 4.5mb
View full answer

6 Replies

@ᴉuɐpɹɐɐ why not just limit the payload size programmatically in route handlers?
Ashy Storm-PetrelOP
Do you think that will make the Vercel cost higher compared to leveraging the Vercel config?
Answer
@ᴉuɐpɹɐɐ vercel already has a payload hard limit of 4.5mb
Ashy Storm-PetrelOP
Thank you very much, do you have a link for that?
Ashy Storm-PetrelOP
Thank you