sinch / node-red-mailgun

A package of nodes for sending and receiving emails from the Mailgun API
https://www.sinch.com
Apache License 2.0
4 stars 1 forks source link

Throw error - TypeError: object is not iterable #2

Open jignesht24 opened 9 months ago

jignesht24 commented 9 months ago

Hi

I am using this node in node--red but when I try to send email it throw error

TypeError: object is not iterable at node:internal/deps/undici/undici:6155:39 at extractBody (node:internal/deps/undici/undici:6170:11) at new Request (node:internal/deps/undici/undici:7114:48) at new Ky (C:\Users\xxx.node-red\node_modules\mailgun.js\mailgun.node.js:2:60421) at t (C:\Users\xxx.node-red\node_modules\mailgun.js\mailgun.node.js:2:64310) at e. (C:\Users\xxx.node-red\node_modules\mailgun.js\mailgun.node.js:2:35504) at C:\Users\xxx.node-red\node_modules\mailgun.js\mailgun.node.js:2:34536 at Object.next (C:\Users\xxx.node-red\node_modules\mailgun.js\mailgun.node.js:2:34641) at C:\Users\xxx.node-red\node_modules\mailgun.js\mailgun.node.js:2:33553

I have tried to use following Nodejs code and run in local machine, it is sending an email.

const API_KEY = 'YOUR_API_KEY'; const DOMAIN = 'YOUR_DOMAIN_NAME';

import formData from 'form-data'; import Mailgun from 'mailgun.js';

const mailgun = new Mailgun(formData); const client = mailgun.client({username: 'api', key: API_KEY});

const messageData = { from: 'Excited User me@samples.mailgun.org', to: 'foo@example.com, bar@example.com', subject: 'Hello', text: 'Testing some Mailgun awesomeness!' };

client.messages.create(DOMAIN, messageData) .then((res) => { console.log(res); }) .catch((err) => { console.error(err); });

Can you please help here?

I am using Node-RED version: v3.1.3, Node.js version: v19.4.0

sinchflows commented 7 months ago

Hello, Could you please provide an example flow that recreates the issue?