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.

this.FormDataConstructor is not a constructor on mailing list create methods

See original GitHub issue

Hello,

When I’m trying to call the lists.create and lists.members.createMembers I’m getting this error : TypeError: this.FormDataConstructor is not a constructor at e.createFormData (/code/node_modules/mailgun.js/webpack:/mailgun/lib/formDataBuilder.ts:30:10) at e.postWithFD (/code/node_modules/mailgun.js/webpack:/mailgun/lib/request.ts:161:43) at e.createMembers (/code/node_modules/mailgun.js/webpack:/mailgun/lib/mailListMembers.ts:65:25)

Here are my calls : const createMembersResponse = await this.mailgunClient.lists.members.createMembers(mailingListAddress, createMembersInput); and const createResponse = await this.mailgunClient.lists.create(createInput);

Other function like lists.members.listMembers are working fine

mailgun.js version 7.0.4

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
EdixonAlbertocommented, Nov 23, 2022

What @krinaxDev is correct, another way to solve this problem in a more elegant way to continue using ES-Modules would be to do the import like this: import * as formData from 'form-data'

1reaction
krinaxDevcommented, Jul 20, 2022

The problem was the import of form data It was like this : import formData from 'form-data'; this.mailgunInstance = new Mailgun(formData); this.mailgunClient = this.mailgunInstance.client({ username: this.username, key: this.apiKey, });

and I replaced it by : const formData = require('form-data'); this.mailgunInstance = new Mailgun(formData); this.mailgunClient = this.mailgunInstance.client({ username: this.username, key: this.apiKey, });

Hope this can help you

Read more comments on GitHub >

github_iconTop Results From Across the Web

formData is not a constructor in react - Stack Overflow
I am getting error that formdata is not constructor while sending using new form data on submit i don't what the mainly problem...
Read more >
FormData() - Web APIs - MDN Web Docs - Mozilla
The FormData () constructor creates a new FormData object.
Read more >
bad type for FormData · Issue #107 · mailgun/mailgun.js - GitHub
with version 3.x.x, I have an error with "form-data" in a Typescript project: import formData from 'form-data'; import Mailgun from ...
Read more >
How to use the FormData object - DEV Community ‍ ‍
This FormData interface gives us the ability to create key, value pairs with the FormData constructor to represent our form's fields and values....
Read more >
FormData - The Modern JavaScript Tutorial
FormData objects can help with that. As you might have guessed, it's the object to represent HTML form data. The constructor is:.
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