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

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!

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/
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?

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, if you want to continue with it...
Would indeed be very useful if it should be fixed!
Bart

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.

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)

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

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.

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.