N8n API does not work in production mode

Describe the issue/error/question

I have a simple workflow that backs up my workflows to FTP. When I start it manually, it works fine, but when it fires from CRON, the n8n API node is throwing an error.

What is the error message (if any)?


Please share the workflow

Share the output returned by the last node

Information on your n8n setup

  • **n8n version:**0.197.1
  • Database you’re using (default: SQLite): Postgre
  • Running n8n with the execution process [own(default), main]: queue
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: docker

Hey @Martin_Neumann,

This isn’t going to fully solve the issue but… Have you tried using the n8n node?

Yes I just found out that there was a n8n node now.
But the error still remains:
connect ECONNREFUSED at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)

is there a hostname you can use instead of localhost ? did you try that?

1 Like

Yes that was the solution!
Seems that when working in queue mode, you need to use the URL of the editor, when running in simple mode, then localhost seems to work as well. That is something to keep in mind when using the n8n API.


Hey @Martin_Neumann,

That makes sense the worker nodes don’t have the web interface only the main instance and webhook workers do. That might be something worth documenting.

1 Like