this.FormDataConstructor is not a constructor on mailing list create methods
See original GitHub issueHello,
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:
- Created a year ago
- Comments:5
Top GitHub Comments
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'
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