# Debug Function Nodes

**URL:** <https://community.n8n.io/t/debug-function-nodes/1568>\
**Category:** Questions\
**Created:** [June 13, 2020, 7:48pm UTC](https://community.n8n.io/t/debug-function-nodes/1568 "2020-06-13T19:48:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kirst](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/kirst/32/1266_2.png) [@Kirst](https://community.n8n.io/u/Kirst)\
**Post date:** [June 13, 2020, 7:48pm UTC](https://community.n8n.io/t/debug-function-nodes/1568/1 "2020-06-13T19:48:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [June 13, 2020, 8:49pm UTC](https://community.n8n.io/t/debug-function-nodes/1568/2 "2020-06-13T20:49:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kirst](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/kirst/32/1266_2.png) [@Kirst](https://community.n8n.io/u/Kirst)\
**Post date:** [June 13, 2020, 9:04pm UTC](https://community.n8n.io/t/debug-function-nodes/1568/3 "2020-06-13T21:04:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [June 13, 2020, 9:10pm UTC](https://community.n8n.io/t/debug-function-nodes/1568/4 "2020-06-13T21:10:52Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![Kirst](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/kirst/32/1266_2.png) [@Kirst](https://community.n8n.io/u/Kirst)\
**Post date:** [June 13, 2020, 9:23pm UTC](https://community.n8n.io/t/debug-function-nodes/1568/5 "2020-06-13T21:23:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [June 13, 2020, 9:41pm UTC](https://community.n8n.io/t/debug-function-nodes/1568/6 "2020-06-13T21:41:05Z")

</div>

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