Send files to external api

Hi everyone,
I’m running into an issue when trying to upload multiple files from my Next.js app to an external API hosted on Azure.

Here’s my setup:

  • I have a client component with a file upload form.

  • When the user submits the form, it calls a route handler (/api/upload) in my Next.js app.

  • Inside the route handler, I use fetch to send the files to the external API.

Everything works fine when I upload a few files (e.g. 3), but when I try uploading more (around 10 or more), I get the following error:

[Error: aborted]

However, if I test the same request directly in Postman, it works without any issues.

Question:
What’s the best practice for uploading multiple files to an external API from a Next.js application? Should I handle the upload directly from the client to the external API, or is there a recommended way to stream large/multiple files through the route handler?