Next.js Discord

Discord Forum

Large File Fetch

Unanswered
Willow Flycatcher posted this in #help-forum
Open in Discord
Willow FlycatcherOP
When I try to fetch a large file (size 200mb) I get this error:

https://i.mrxbox98.me/file/2023/08/Code_gwbceX73Lq.png

Im trying to fetch it on the server side using the app router API routes

11 Replies

Willow FlycatcherOP
The fetch works normally when I try in node
do u mean it works in Vercel Node.js runtime, but it fails Vercel Edge runtime?
@tafutada777 do u mean it works in Vercel Node.js runtime, but it fails Vercel Edge runtime?
Willow FlycatcherOP
No, when I try the same exact fetch request it works in NodeJS but when its runned in a api route it errors out
nextjs has a request and response body limit, (they are configurable)
for large files they are typically served from a presigned url
also if you deploy to a serverless provider like vercel, fetching and sending a 200mb file may take longer than 60s (which is the max time a function can run)
@linesofcode nextjs has a request and response body limit, (they are configurable)
Willow FlycatcherOP
Where can I configure it?
Next config
In your root
Google for the terms I mentioned
And you’ll find examples