Debug Function Nodes

Hi,

Function nodes are a great way to create custom logic. I have run into situations where some code works perfectly outside of the Function node and even completes in the workflow, but not have the desired result.

I have looked to see whether there are any articles on debugging Function nodes, but nothing came up. Would be great if anyone can point me to logs or debug steps etc.

How are you running n8n? Because normally you can simply do a console.log() and it will display the output in the terminal you did start n8n in.

1 Like

Hi Jan

Thank you for reply. I’m using the docker instance together with the tunnel and when i do a console.log nothing appears. I will give it another go tomorrow And validate whether that is correct.

hm I just tried again to be 110% sure and for me it displays it totally fine when I start n8n like this:

docker run -it --rm   --name n8n   -p 5678:5678   -v ~/.n8n:/root/.n8n   n8nio/n8n:0.70.0   n8n start --tunnel

Thanks Jan

I tried it as well and console.log does work. I think the issue I get is that it never reaches that line in the application. There is no obvious reason why it wouldn’t do that because the code works standalone outside of the environment. Do you have any suggestions whether there are other logs that I can look at to understand why it never reaches that part of the code ie. is there a way to debug the functions is VSC?

Sadly not. But if it fails then you should see the error displayed in the Function-Node.