**Error: "input.split is not a function (item 0)" in N8N Gmail Node**

Issue: Error: “input.split is not a function (item 0)” in N8N Gmail Node

I’m encountering an error when using N8N’s Gmail node to send an email. The error message is:

“input.split is not a function (item 0)”

Context:

  • Node: Gmail node (operation: send email)
  • Source: Data is being pulled from a previous node (a database) via the “response” field.
  • Error Trigger: The workflow runs fine, but when it gets to the Gmail node, I receive the split error.
  • What I’m Using:
    • I’m dynamically passing to, subject, and message fields to the Gmail node using expressions like {{$json.message.content.to}} and others for subject and message.
    • I have the “Specify Input Schema” option enabled in the email node.

Troubleshooting So Far:

  • The error seems to indicate that the Gmail node is trying to split a value that isn’t a string (likely undefined or null).
  • I’ve verified that some fields, like bccList, are undefined, but they’ve been empty in the past without causing issues.
  • I attempted hardcoding the to, subject, and message fields with static strings, and the email sends successfully, so the issue seems to lie in how the dynamic data is being passed.

What I’ve Tried:

  • Adding fallback values to the fields (e.g., {{$json.message.content.to || '[email protected]'}}) to ensure nothing is undefined.
  • Debugging the “response” field, but it seems to contain the expected data structure.

Questions:

  1. Is this error related to how N8N handles undefined or empty values in specific fields?
  2. Could the “Specify Input Schema” setting be causing the issue? How should I properly configure it for email nodes?
  3. Any other troubleshooting tips for preventing this “split” error when passing dynamic data to the Gmail node?

Thanks for your help!

The gmail node: {
“meta”: {
“instanceId”: “36b7251c6ad6e7f498073af8dcd52f607ff829cf47cd1af3ce3282d097429edb”
},
“nodes”: [
{
“parameters”: {
“sendTo”: “={{ $json.message.content.to }}”,
“subject”: “={{ $json.message.content.subject }}”,
“emailType”: “text”,
“message”: “={{ $json.message.content.message }}”,
“options”: {
“appendAttribution”: false,
“bccList”: “={{ $json.message.content.bccList || }}”,
“ccList”: “={{ $json.message.content.ccList || }}”,
“senderName”: “=James, David’s AI Bot”
}
},
“id”: “1dccc81d-ab72-4b57-b82a-b0a51c8d25b1”,
“name”: “Gmail”,
“type”: “n8n-nodes-base.gmail”,
“typeVersion”: 2.1,
“position”: [
1340,
620
],
“credentials”: {
“gmailOAuth2”: {
“id”: “we19m4AKI8reQ2PL”,
“name”: “Gmail account”
}
}
}
],
“connections”: {},
“pinData”: {}
}

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Following up with the details on this:

From Gmail

Full message

input.split is not a function (item 0)

Other info

Item Index

0

Node type

n8n-nodes-base.gmail

Node version

2.1 (Latest)

n8n version

1.55.3 (Cloud)

Time

9/14/2024, 3:15:22 PM

Stack trace

NodeOperationError: input.split is not a function (item 0) at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Google/Gmail/v2/GmailV2.node.js:549:23) at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:728:42) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:673:66 at processTicksAndRejections (node:internal/process/task_queues:95:5) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1104:20

Gmail

Parameters

Settings


Docs

Credential to connect with

Resource

Operation

To

Fixed

Expression

{{ $json.message.content.to }}

[email protected]

Subject

Fixed

Expression

{{ $json.message.content.subject }}

Erinnerung: Bitte sende mir den Link zum Hochladen der Dokumente

Email Type

Message

Fixed

Expression

{{ $json.message.content.message }}

Liebe Maria Elisabeth, ich hoffe, es geht dir gut. Ich möchte XXX. Vielen Dank für deine Unterstützung. Mit freundlichen Grüßen, David

Options

Append n8n Attribution

Fixed

Expression

BCC

Fixed

Expression

{{ $json.message.content.bccList || }}

[Array: ]

CC

Fixed

Expression

{{ $json.message.content.ccList || }}

[Array: [“[email protected]”]]

Sender Name

Fixed

Expression

James, David’s AI Bot

James, David’s AI Bot

I wish this node would…

1 Like

i wish it too