Email Trigger (IMAP) Node Reads Email, But Doesn't Execute Additional Nodes

Describe the problem/error/question

I reported something similar back in January 2023 (see https://community.n8n.io/t/imap-email-node-no-longer-triggering-workflow/17958/32) where the Email Trigger (IMAP) node reads incoming email and marks an email as read, but it does not execute the remainder of the workflow (no history appears in the execution log either),

Curiously, the Email Trigger (IMAP) node and remaining workflow does work properly when manually executed with the “Execute Workflow” button.

IMAP credentials (non-Gmail) show as “Connection tested successfully”.

It appears to have stopped working 2+ months ago, but I thought it may have been caused by not upgrading to v1+ (previously was on v0.237.0). I recently upgraded to v1+ and it did not solve the issue. I also deleted the Email Trigger (IMAP) node and added a new one and that did not fix the issue either.

I am not using the Force Reconnect Every X Minutes option as that did not help previously and was not needed after an update was pushed out around March 2023.

I look forward to your help and suggestions to get it working again properly. Thanks!

Information on your n8n setup

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

Hey @MortgageRockstar,

Can you enable debug logging in n8n and restart your workflow (disable then activate) and if it continues to happen send over the log output so I can take a look. I would recommend using the force reconnect option as it may help now.

Which mail provider are you using as well?

@Jon, email is handled through DirectAdmin on a VPS hosted at KnownHost using port 993 with SSL/TLS.

I tried to enable logging using the environment variables below as suggested at https://docs.n8n.io/hosting/logging-monitoring/logging/, but I get an Internal Server warning, “The server encountered an internal error or misconfiguration and was unable to complete your request.” and n8n does not start.

N8N_LOG_LEVEL=debug
N8N_LOG_OUTPUT=file
N8N_LOG_FILE_LOCATION=/home/user/n8n-logs/n8n.log
N8N_LOG_FILE_MAXSIZE=50
N8N_LOG_FILE_MAXCOUNT=60

Try leaving log out the other options and only set the n8n_log_level option for now.

Thanks @Jon.

The n8 service is now up using that only the N8N_LOG_LEVEL environment variable.

It appears the logs are stored in the /home/user/n8n/.n8n folder in a file named n8nEventLog.log.

Is that correct? If so, I don’t see any errors after de-activating and re-activating the workflow.

{"__type":"$$EventMessageAudit","id":"9689dab1-9916-483a-a9e2-c69490180067","ts":"2023-12-12T10:40:22.481-05:00","eventName":"n8n.audit.workflow.updated","message":"n8n.audit.workflow.updated","payload":{"userId":"1dd7e168-05c9-46f9-9db1-a3615c7849ff","_email":"[email protected]","_firstName":"John","_lastName":"Smith","globalRole":"member","workflowId":"BlBlzb7N4RCaQAa3","workflowName":"Test Workflow"}}
{"__type":"$$EventMessageConfirm","confirm":"9689dab1-9916-483a-a9e2-c69490180067","ts":"2023-12-12T10:40:22.481-05:00","source":{"id":"0","name":"eventBus"}}
{"__type":"$$EventMessageAudit","id":"dffff5cc-9a24-4bcb-bce1-3c9879ce6fa2","ts":"2023-12-12T10:40:26.743-05:00","eventName":"n8n.audit.workflow.updated","message":"n8n.audit.workflow.updated","payload":{"userId":"1dd7e168-05c9-46f9-9db1-a3615c7849ff","_email":"[email protected]","_firstName":"John","_lastName":"Smith","globalRole":"member","workflowId":"BlBlzb7N4RCaQAa3","workflowName":"Test Workflow"}}
{"__type":"$$EventMessageConfirm","confirm":"dffff5cc-9a24-4bcb-bce1-3c9879ce6fa2","ts":"2023-12-12T10:40:26.749-05:00","source":{"id":"0","name":"eventBus"}}

Hey @MortgageRockstar,

The file should be something like n8n.log the n8nEventLog.log file will show you if a node or workflow has run.

@Jon, I searched for a n8n.log file, but I could not find one.

I noticed though that the default value for N8N_LOG_OUTPUT is console and not file so I just added that environment value back to my docker-compose-yml file. Previously you suggested that I remove all logging environment values except N8N_LOG_LEVEL.

I tried adding N8N_LOG_FILE_LOCATION too, but it’s causing the Internal Server warning and n8n does not start. I created the n8n-logs directory and gave it 777 permissions so I’m not sure why it’s not working. Do you have any suggestions?

I’ll let you know if n8n now creates a log and share the output. However I’m not really expecting anything since the Email Trigger (IMAP) appears to fire correctly and read the email, but then never kicks off the remainder of the workflow similar to the issue that I had in the past. My guess is that it is a problem with the node itself again.

By the way, I enabled the Force Reconnect option soon after you suggested trying that to and that did not help either.

Hey @MortgageRockstar,

Ah yeah my mistake, The output would be in the docker log if it is not set to file so you could set it to file and leave the location and it will sort itself out.

Normally if the node marks the email as read everything is all good so it sounds like there could be something out of order in the node or maybe it is trying to process a “bad” email in theory we should see a bit more in the debug output for the node if not I might be able to make a special version of n8n that you could try and run with extra logging in it.

Thanks for the additional information, @Jon.

This workflow had been working fine for months (with no changes made) before I encountered this issue again. If I execute it manually, it still works fine with no errors so something odd is occurring with the Email Trigger (IMAP) node.

In any event, I’ll hopefully have an error log to share with you soon.

1 Like

@Jon , I’ve had logging enabled over a week now and there are no logs showing the workflow with the Email Trigger (IMAP) node as having executed (nor in the Executions screen) despite emails being delivered to the mailbox it monitors and those emails showing as read. I stand by my initial report that there is an error with the Email Trigger (IMAP) node.

Can you kindly investigate this further and fix?

Hi @Jon. Any updates or suggesting to resolve the issue with the Email Trigger node?

Hey @MortgageRockstar,

I was off for a few weeks at the end of the year, What I will do is create a debug build with extra logging for you so we can see what is going on.

Thanks for getting back to me, @Jon. I hope you enjoyed your time off.

I’m open to any and all suggestions to get this issue resolved. Let me know what I can do on my end to help.

Checking back in about this issue since it persists, @Jon.

Any progress or updates?

Hey @MortgageRockstar,

I have been covering all of support for the last week but I am looking at getting something together this week for this. I believe we are planning to overhaul the IMAP node soon (possibly this quarter) which may also help.

Give me a couple of days and I will be back.

Hi @Jon. Checking back in regarding this issue.

The Email Trigger node is pretty important to my business so I would like to get a fix ASAP.

Please let me know if there is anything I can do to help.

Hey @MortgageRockstar,

It is on my list to look into further this month, I am expecting to have a debug version you can use soon that that should have some extra debugging logging.

Thanks @Jon.

Please let me know when the extra debugging functionality is available and I’ll be happy to implement it. Hopefully it can pinpoint the issue with the node.

1 Like

Any update, @Jon?

I have some logging in my local branch that just mimics what the debug output should show, I will be pushing it up later today so you can give it a test run and we can see what the output is without needing to set extra environment options.

This will be a test build of n8n and you will need to capture the docker output which is where the information will be.