question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support `FormData` Node.js v18

See original GitHub issue

Since Node.js v18, FormData is part of the native Node.js’ API:

image

Unfortunately mailgun.js doesn’t support it yet. Furthermore the recommended form-data library is unmaintained and not a good alternative.

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
olexandr-mazepacommented, Dec 19, 2022

Hi RemyMachado Currently, Axios isn’t compatible with FormData implemented in node 18. I don’t want to switch to another package because I believe this issue will be fixed in Axios soon.

Here is a related issue in the Axios library that may be used for tracking: https://github.com/axios/axios/issues/5327

0reactions
olexandr-mazepacommented, Dec 23, 2022

There are a few reasons:

  • First one. Fetch API was added to the node.js started only from v17(experimental support). I still have been trying to make this package available from node 12.
  • The second one is this comparison article https://www.geeksforgeeks.org/difference-between-fetch-and-axios-js-for-making-http-requests/ . A few items from the table at the bottom are bothering me(built-in XSRF protection, name of body property, stringifying of a data object, canceling the request, etc.).
  • The third one is that I recently moved from ky to Axios, and don’t want to repeat this experience =)

Of course, they won’t stop me if node 18 support in Axios takes too much time but in this particular case, I would rather wait some time. Axios will need to implement compatibility with node 18 anyway, and it seems there is a PR already that should fix the issue with form data.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use FormData global when targeting Node.js 18 #2077 - GitHub
https://nodejs.org/api/globals.html#class-formdata And remove the dependency. ... Use FormData global when targeting Node.js 18 #2077.
Read more >
Unable to use createReadStream with Node 18 FormData
It looks like the new built-in FormData supports a ReadableStream (from the webStream interface) to be compatible with the browser and that's ...
Read more >
Node.js 18 is now available!
Node.js 18 will be supported until April 2025. ... following globals are made available: fetch , FormData , Headers , Request , Response...
Read more >
formdata-node - npm
Spec-compliant FormData implementation for Node.js. ... Start using formdata-node in your project by running `npm i formdata-node`.
Read more >
formdata-node - npm Package Health Analysis - Snyk
Spec-compliant FormData implementation for Node.js For more information about how to use this package see README · Ensure you're using the healthiest npm ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found