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.

FormData is incompatible with current version of mailgun.js

See original GitHub issue

Hello,

I recently upgraded a project that made use of this library to typescript and I’ve been getting a typescript error.

Screenshot 2022-01-02 at 14 37 56 . It seems the form-data library expects an optional parameter and that doesn't align with the type definition for the mailgun class. I tried using `global.FormData` instead of the npm library but that was incompatible with `mailgun.js`.

I’m not sure if I’m doing something wrong but I’ll appreciate any help I can get. I also tried downgrading form-data to v3 and I still got the same error.

"mailgun.js": "4.1.4"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
olexandr-mazepacommented, Jan 17, 2022

We’re also experiencing issues with the usage of FormData in this project. We’ve actually been unable to update in a very long time (we’re stuck on v3.6.1). Our project isn’t typescript, but JS with a CommonJS setup, and we get the following error when doing static type checking:

import NodeFormData
Module '".../node_modules/form-data/index"' can only be default-imported using the 'esModuleInterop' flagts(1259)
index.d.ts(10, 1): This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.

This error is thrown in the following files: dist/lib/interfaces/IFormData.d.ts:1:8 dist/lib/request.d.ts:1:8

Hello @gdieguez Adding “allowSyntheticDefaultImports”: true option to your tsconfig.json file should fix this issue.

0reactions
olexandr-mazepacommented, Jan 17, 2022

Okay, thank you for your time, I am glad that you don’t have the issue anymore.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mailgun.js - npm
A javascript sdk for Mailgun built with webpack, babel & es6. This can be used in node or in the browser*.. Latest version:...
Read more >
Mailgun.js: A JavaScript SDK for Mailgun - Morioh
Mailgun.js is a JavaScript sdk for Mailgun built with webpack, babel & es6. ... NOTE: starting from version 3.0 you need to pass...
Read more >
Multipart/form-data field names are encoded incorrectly
I'm using Mailgun's REST API in a Cloudflare Worker. The API requires a POST of multipart/form-data. Some of the API's form fields have...
Read more >
Third-party software dependencies | Elastic Cloud Enterprise ...
Library Version Optional/Required Packaged akka‑actor_2.13 2.6.18 Required Yes akka‑http‑core_2.13 10.2.7 Required Yes akka‑http‑json4s_2.13 1.27.0 Required Yes
Read more >
Messages — Mailgun API documentation
text version of the email. This field is always present. If the incoming message only has HTML body, Mailgun will create a text...
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