I’m seeing a weird issue since moving mailboxes from an on premise Exchange Installation to Exchange online.
EmailReadImap node sucessfully authenticates and can obtain e-mails
When a new e-mail is received, the e-mail is almost instantly marked as read (this doesnt happen if the workflow is disabled)
The corresponding workflow is not triggered, I can’t see any executions
When I increase the log level to debug I can see the folowing line
Mar 18 14:28:49 n8n node[2751]: 2022-03-18T13:28:49.747Z | #033[34mdebug#033[39m | #033[34mQuerying for new messages on node "EmailReadImap"#033[39m {"searchCriteria":["UNSEEN",["UID","473:*"]],"file":"EmailReadImap.node.js","function":"onmail"}
Hey @SupersonicWaffle, I am very sorry to hear you’re encountering this behaviour. I don’t have access to an Exchange server unfortunately, but quickly have tested this with a bunch of other email providers and did not run into this problem.
Are you saving the data for successful executions of your workflow? This can be configured in the workflow settings:
yes this is active. What is weird to me is that this worked beautifully for months before migrating to an Exchange Online (Microsoft 365 hosted) instance. On the other hand, I can see n8n marking the mails as read and the aforementioned line in the logs so it leads me to believe that this shouldn’t be an issue with Exchange Online
All that I have changed is the credential data.
EDIT: It might also be worth mentioning, that I have another n8n instance with workflows being triggered from IMAP on a different Exchange Online tenant that works fine as well
EDIT2: can you confirm I should be seeing something about a workflow execution in the logs after the email is read?
on n8n instance 1 and exchange online instance 1, mails can be read as well on a manual execution, however, the workflow wont fire on new emails although n8n marks the email as read and logs show an email is received.
I will try setting up a workflow on n8n instance 2 and see if it fires on new emails on exchange online instance 1.
Thanks, meanwhile here’s the output from my n8n container with N8N_LOG_LEVEL=debug when receiving an email (workflow 3 is my IMAP test workflow) for reference:
n8n | Editor is now accessible via:
n8n | http://localhost:5678/
n8n | 2022-03-22T10:31:17.717Z | debug | Querying for new messages on node "EmailReadImap" {"searchCriteria":["UNSEEN",["UID","46:*"],["UID","46:*"]],"file":"EmailReadImap.node.js","function":"onmail"}
n8n | 2022-03-22T10:31:18.012Z | debug | Received trigger for workflow "IMAP Test" {"file":"ActiveWorkflowRunner.js","function":"returnFunctions.emit"}
n8n | 2022-03-22T10:31:19.208Z | debug | Received child process message of type start for execution ID 36. {"executionId":"36","file":"WorkflowRunner.js"}
n8n | 2022-03-22T10:31:19.218Z | verbose | Initializing n8n sub-process {"pid":21,"workflowId":3,"file":"WorkflowRunnerProcess.js","function":"runWorkflow"}
n8n | 2022-03-22T10:31:19.456Z | verbose | Workflow execution started {"workflowId":3,"file":"WorkflowExecute.js","function":"processRunExecutionData"}
n8n | 2022-03-22T10:31:19.458Z | debug | Received child process message of type processHook for execution ID 36. {"executionId":"36","file":"WorkflowRunner.js"}
n8n | 2022-03-22T10:31:19.458Z | debug | Start processing node "IMAP Email" {"node":"IMAP Email","workflowId":3,"file":"WorkflowExecute.js"}
n8n | 2022-03-22T10:31:19.459Z | debug | Running node "IMAP Email" started {"node":"IMAP Email","workflowId":3,"file":"WorkflowExecute.js"}
n8n | 2022-03-22T10:31:19.459Z | debug | Executing hook (hookFunctionsPush) {"executionId":"36","workflowId":3,"file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteBefore"}
n8n | 2022-03-22T10:31:19.460Z | debug | Received child process message of type processHook for execution ID 36. {"executionId":"36","file":"WorkflowRunner.js"}
n8n | 2022-03-22T10:31:19.460Z | debug | Running node "IMAP Email" finished successfully {"node":"IMAP Email","workflowId":3,"file":"WorkflowExecute.js"}
n8n | 2022-03-22T10:31:19.461Z | debug | Received child process message of type processHook for execution ID 36. {"executionId":"36","file":"WorkflowRunner.js"}
n8n | 2022-03-22T10:31:19.461Z | verbose | Workflow execution finished successfully {"workflowId":3,"file":"WorkflowExecute.js","function":"processSuccessExecution"}
n8n | 2022-03-22T10:31:19.462Z | debug | Received child process message of type processHook for execution ID 36. {"executionId":"36","file":"WorkflowRunner.js"}
n8n | 2022-03-22T10:31:19.463Z | debug | Executing hook (hookFunctionsSave) {"executionId":"36","workflowId":3,"file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}
n8n | 2022-03-22T10:31:19.463Z | debug | Save execution data to database for execution ID 36 {"executionId":"36","workflowId":3,"finished":true,"stoppedAt":"2022-03-22T10:31:19.461Z","file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}
n8n | 2022-03-22T10:31:19.468Z | debug | Received child process message of type end for execution ID 36. {"executionId":"36","file":"WorkflowRunner.js"}
n8n | 2022-03-22T10:31:19.484Z | debug | Executing hook (hookFunctionsPush) {"executionId":"36","workflowId":3,"file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}
Mar 22 12:33:45 n8n multipathd[690]: sda: add missing path
Mar 22 12:33:45 n8n multipathd[690]: sda: failed to get udev uid: Invalid argument
Mar 22 12:33:45 n8n multipathd[690]: sda: failed to get sysfs uid: Invalid argument
Mar 22 12:33:45 n8n multipathd[690]: sda: failed to get sgio uid: No such file or directory
Mar 22 12:33:49 n8n node[158112]: 2022-03-22T11:33:49.115Z | #033[34mdebug#033[39m | #033[34mQuerying for new messages on node "EmailReadImap"#033[39m {"searchCriteria":["UNSEEN",["UID","352:*"]],"file":"EmailReadImap.node.js","function":"onmail"}
Mar 22 12:33:50 n8n multipathd[690]: sda: add missing path
Mar 22 12:33:50 n8n multipathd[690]: sda: failed to get udev uid: Invalid argument
Mar 22 12:33:50 n8n multipathd[690]: sda: failed to get sysfs uid: Invalid argument
Mar 22 12:33:50 n8n multipathd[690]: sda: failed to get sgio uid: No such file or directory
not sure what the problem with multipathd is. This is an instance where I installed n8n as a service because I needed to execute a local application in a workflow.
As you can see, it seems “onmail” is called but I don’t have log entries about a workflow being triggered.
That doesn’t look like the n8n logs, are you looking at logs on the OS instead? The multipathd issues are probably down to it being a virtual server possibly ESXI as the hypervisor but you should be able to fix those at the hypervisor level if you have access to it or by tweaking the multipathd config file.
Can you configure n8n to log to file and check the text log it will have the same information but won’t have the OS messages in it as well, You might be able to just grep for node as well.
Indeed I have configured n8n to log to /var/log/n8n.log but ended up looking at /var/log/syslog
The things muscle memory do to you
Here’s an excerpt from n8n.log
{"level":"debug","message":"Querying for new messages on node \"EmailReadImap\"","metadata":{"file":"EmailReadImap.node.js","function":"onmail","searchCriteria":["UNSEEN",["UID","317:*"]],"timestamp":"2022-03-22T12:59:38.555Z"}}
{"level":"verbose","message":"Forcing reconnection of IMAP node.","metadata":{"file":"EmailReadImap.node.js","timestamp":"2022-03-22T12:59:38.967Z"}}
{"level":"debug","message":"Querying for new messages on node \"EmailReadImap\"","metadata":{"file":"EmailReadImap.node.js","function":"onmail","searchCriteria":["UNSEEN",["UID","210:*"]],"timestamp":"2022-03-22T12:59:39.722Z"}}
{"level":"debug","message":"Querying for new messages on node \"EmailReadImap\"","metadata":{"file":"EmailReadImap.node.js","function":"onmail","searchCriteria":["UNSEEN",["UID","352:*"]],"timestamp":"2022-03-22T13:00:15.451Z"}}
{"level":"debug","message":"Wait tracker querying database for waiting executions","metadata":{"file":"WaitTracker.js","function":"getwaitingExecutions","timestamp":"2022-03-22T13:00:33.970Z"}}
Sorry for not getting back here, have been very busy and refactored the workflows to use the Outlook node since Microsoft is deprecating basic auth anyways.