# How to find the root cause of a Node error/warning when node-red is starting

**URL:** https://discourse.nodered.org/t/how-to-find-the-root-cause-of-a-node-error-warning-when-node-red-is-starting/6395
**Category:** Developing Nodes
**Created:** [4 January 2019 16:27 UTC](https://discourse.nodered.org/t/how-to-find-the-root-cause-of-a-node-error-warning-when-node-red-is-starting/6395 "2019-01-04T16:27:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![germancmartinez](https://avatars.discourse-cdn.com/v4/letter/g/2bfe46/32.png) [@germancmartinez](https://discourse.nodered.org/u/germancmartinez)
#### Post date: [4 January 2019 16:27 UTC](https://discourse.nodered.org/t/how-to-find-the-root-cause-of-a-node-error-warning-when-node-red-is-starting/6395/1 "2019-01-04T16:27:23Z")

</div>

Hi,

I´m trying to create my own MongoDB connector using the MongoDB node.js driver. To do that I'm creating a node with its corresponding configuration node. I don't get any error when installing my library using npm install but I get an error during the node-red startup. Just to mention, the error is "TypeError: Cannot convert undefined or null to object" and its related to the config node.  
**The question is:** Is there any way to know wich is the code line that is generating the error/warning? I´ve no idea where the problem could be and I'm not able to find any debugging tool to find it.

Thanks in advance!

---

<div class="post-metadata">

### Author: ![germancmartinez](https://avatars.discourse-cdn.com/v4/letter/g/2bfe46/32.png) [@germancmartinez](https://discourse.nodered.org/u/germancmartinez)
#### Post date: [4 January 2019 20:26 UTC](https://discourse.nodered.org/t/how-to-find-the-root-cause-of-a-node-error-warning-when-node-red-is-starting/6395/2 "2019-01-04T20:26:06Z")

</div>

This is the log output:

\_4 Jan 17:16:58 - [info]

# Welcome to Node-RED

4 Jan 17:16:58 - [info] Node-RED version: v0.19.5  
4 Jan 17:16:58 - [info] Node.js version: v8.9.4  
4 Jan 17:16:58 - [info] Windows\_NT 10.0.14393 x64 LE  
4 Jan 17:17:00 - [info] Loading palette nodes  
4 Jan 17:17:03 - [warn] ------------------------------------------------------  
4 Jan 17:17:03 - [warn] [node-red-sherpa/RepositoryConfNode] TypeError: Cannot convert undefined or null to object  
4 Jan 17:17:03 - [warn] ------------------------------------------------------  
4 Jan 17:17:03 - [info] Settings file : \Users\Administrator.node-red\settings.js  
4 Jan 17:17:03 - [info] Context store : 'default' [module=memory]  
4 Jan 17:17:03 - [info] User directory : \Users\Administrator.node-red  
4 Jan 17:17:03 - [warn] Projects disabled : git command not found  
4 Jan 17:17:03 - [info] Flows file : \Users\Administrator.node-red\flows\_WIN-RO73BMGTL4F.json  
4 Jan 17:17:03 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/)  
4 Jan 17:17:03 - [warn]

* * *

Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials  
file will not be recoverable, you will have to delete it and re-enter  
your credentials.

## You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change.

4 Jan 17:17:03 - [info] Starting flows  
4 Jan 17:17:03 - [info] Started flows\_

Is there any way of identify the root cause of the problem? The code line number maybe?

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [4 January 2019 20:54 UTC](https://discourse.nodered.org/t/how-to-find-the-root-cause-of-a-node-error-warning-when-node-red-is-starting/6395/3 "2019-01-04T20:54:27Z")

</div>

> [@germancmartinez](#):
>
> The code line number maybe?

Hi @germancmartinez,  
Node-RED already contains a piece of code to show the line number, but it doesn't work correctly. I have looked at this in the past, but never solved it. Here is the [information](https://groups.google.com/forum/#!topic/node-red/m3iruVOY3oo), if you want to continue with it...  
Would indeed be very useful if it should be fixed!  
Bart

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [4 January 2019 22:45 UTC](https://discourse.nodered.org/t/how-to-find-the-root-cause-of-a-node-error-warning-when-node-red-is-starting/6395/4 "2019-01-04T22:45:03Z")

</div>

> [@BartButenaers](#):
>
> Node-RED already contains a piece of code to show the line number, but it doesn't work correctly

It does work correctly when node.js provides us a line number to display. If it doesn't give us a number (and there are circumstances where it doesn't) , there's nothing we can do to pluck it out of thin air.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [6 January 2019 03:46 UTC](https://discourse.nodered.org/t/how-to-find-the-root-cause-of-a-node-error-warning-when-node-red-is-starting/6395/5 "2019-01-06T03:46:57Z")

</div>

Hi.....

Could I suggest "bombing" the flow with nodes to capture data and put it in a queue?

(eg: [node-red-contrib-queue-gate (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-queue-gate))

And seeing if "anyone" is sending a null msg.payload? Because:

> [@germancmartinez](#):
>
> [node-red-sherpa/RepositoryConfNode] TypeError: Cannot convert undefined or null to object

Would - to me - imply somewhere there is a naughty msg.payload getting around.

Maybe monitor that part of the flow first and see what happens.

Just a thought.

---

<div class="post-metadata">

### Author: ![germancmartinez](https://avatars.discourse-cdn.com/v4/letter/g/2bfe46/32.png) [@germancmartinez](https://discourse.nodered.org/u/germancmartinez)
#### Post date: [6 January 2019 04:14 UTC](https://discourse.nodered.org/t/how-to-find-the-root-cause-of-a-node-error-warning-when-node-red-is-starting/6395/6 "2019-01-06T04:14:12Z")

</div>

Thanks for your replies. I’ve finally discover where the problem was. My node constructor was declared as async and thats make Node-Red fail.
