I am trying to send an email via gmail using a service account. I have enabled the API and enabled domain wide delegation. When setting up the node and the service account within n8n the connection tested successfully, but when I test the actual now I get the following error message:
{
"errorMessage": "Bad request - please check your parameters (item 0)",
"errorDescription": "Precondition check failed.",
"errorDetails": {
"rawErrorMessage": [
"400 - {\"error\":{\"code\":400,\"message\":\"Precondition check failed.\",\"errors\":[{\"message\":\"Precondition check failed.\",\"domain\":\"global\",\"reason\":\"failedPrecondition\"}],\"status\":\"FAILED_PRECONDITION\"}}"
]
},
"n8nDetails": {
"nodeName": "Gmail",
"nodeType": "n8n-nodes-base.gmail",
"nodeVersion": 2.1,
"resource": "message",
"operation": "send",
"itemIndex": 0,
"time": "8/31/2024, 8:17:43 PM",
"n8nVersion": "1.56.2 (Self Hosted)",
"binaryDataMode": "default",
"stackTrace": [
"NodeOperationError: Bad request - please check your parameters (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 processTicksAndRejections (node:internal/process/task_queues:95:5)",
" at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:728:19)",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:673:51",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1104:20"
]
}
}
I also should add that the workflow works fine if I use OAuth and a “regular” Gmail account.
Any help with this would be greatly appreciated!