# Cannot Read property 'on' of undefined (sometimes)

**URL:** <https://discourse.nodered.org/t/cannot-read-property-on-of-undefined-sometimes/50260>\
**Category:** General\
**Created:** [27 August 2021 08:32 UTC](https://discourse.nodered.org/t/cannot-read-property-on-of-undefined-sometimes/50260 "2021-08-27T08:32:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aytaral](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@aytaral](https://discourse.nodered.org/u/aytaral)\
**Post date:** [27 August 2021 08:32 UTC](https://discourse.nodered.org/t/cannot-read-property-on-of-undefined-sometimes/50260/1 "2021-08-27T08:32:47Z")

</div>

Hello there.  
In a node running 24/7, this error happens from time to time during the day.  
It doesn't get fixed without restarting nodered.  
mssql node is updating sql every minute. there is no error but this error occurs occasionally.  
The version of node and other components is up to date.  
Im running on raspberry pi.

Aso it doesn't catch this error on node even though I added catch-all.  
I tried restarting norered in the catch-all state because I couldn't solve the problem. it doesn't come in either.  
What could be the cause of the problem?  
thanks.

 ![err](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/b/6bc846ce12fbe59438ad455b2102ccdb2a443f35.jpeg)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [27 August 2021 10:25 UTC](https://discourse.nodered.org/t/cannot-read-property-on-of-undefined-sometimes/50260/2 "2021-08-27T10:25:59Z")

</div>

> [@aytaral](#):
>
> Aso it doesn't catch this error on node even though I added catch-all.

If you use MSSQL-PLUS nodes there is an option to throw errors so that you can catch them.

Also, attach a debug node to the function just before the MSSQL node & check the values going in are as expected.

---

<div class="post-metadata">

**Author:** ![aytaral](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@aytaral](https://discourse.nodered.org/u/aytaral)\
**Post date:** [28 August 2021 09:37 UTC](https://discourse.nodered.org/t/cannot-read-property-on-of-undefined-sometimes/50260/3 "2021-08-28T09:37:49Z")

</div>

Thanks for your reply.  
I will try yous said.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 October 2021 09:37 UTC](https://discourse.nodered.org/t/cannot-read-property-on-of-undefined-sometimes/50260/4 "2021-10-27T09:37:56Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
