Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next.js Edge Runtime #426

Open
FynniX opened this issue Nov 6, 2024 · 1 comment
Open

Next.js Edge Runtime #426

FynniX opened this issue Nov 6, 2024 · 1 comment

Comments

@FynniX
Copy link

FynniX commented Nov 6, 2024

Hello,
when I want to use this inside next.js in the edge runtime, then I get a error.

 [Error: Bad Request] {
  status: 400,
  message: 'Bad Request',
  details: 'Boundary not found for multipart/form-data request',
  type: 'MailgunAPIError'
}

The error happens when I want to use the FormData from next.js edge runtime api.

@olexandr-mazepa
Copy link
Collaborator

olexandr-mazepa commented Feb 24, 2025

Hello @FynniX
This happens due to the limitations of Next.js "Edge runtime" and the usage of Axios under the hood of the Mailgun.js
With this combination (Axios + Edge runtime), the "Boundary" header for multipart/form-data is never set.

I will work on this in the near future.

As for now I can suggest few options on how to avoid the issue:

  • Move the usage of Mailgun from the middleware to the route resolver.
  • Use fetch to access the Mailgun API directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants