TypeError when using Gmail (Developer) source

Hi, I’m using the Gmail (Developer) source to send an email but I’m receiving the following error.

TypeError
this.to.join is not a function

DETAILS
at Object.run (file:///tmp/pdg/dist/code/fe557512e839d63b51e3d1b4c6bfd253a08cf7acc4770cfd97af036a245ea2d5/code/gmail/actions/send-email/send-email.mjs:102:64)
at process.processTicksAndRejections (internal/process/task_queues.js:95:5)
at global.executeComponent (/var/task/launch_worker.js:139:22)
at MessagePort.messageHandler (/var/task/launch_worker.js:598:28)

Hi @wwc-776

The join function is on an Array in Javascript.

This means that the input you’re passing is must likely a single string.

You’ll need to convert it to an array. Is it possible you entered in a custom expression?

Hi Pierce,

Thanks for helping. I entered the recipient’s email address into the prop that’s causing the error.

Here’s a screenshot of the prop. I tried it with an array and with a single email address.

If I understand it correctly, a single email address can simply be put in and if it’s multiple email addresses then they need to be in an array. Is that right?

I figured out what my mistake was. Sorry about that. I was inputting it wrong. It’s working now. Thanks for responding to my help request.

Have a good weekend.

Thanks for the screenshot, glad you were able to figure it out!

For anyone else with this issue, don’t forget to evaluate to an array if you’re passing text.

For example, if you selected Custom Expression and simply type in:

["me@gmail.com"]

That will still evaluate as a string. Or literally "['me@gmail.com']". Notice the quotes outside of the array brackets [], which is a string not an array.

To evaluate as an array, use the special handlebars {{ }} to tell Pipedream to evaluate Javascript instead.

So to create a static array, use this instead:

{{ [ 'me@gmail.com' ] }}

The handlebars tell the prop to evaluate ["me@gmail.com"] as Javascript, not just simple text.

1 Like