Flow stops working, why? and how to fix it? (TypeError: Cannot read property '0' of null)

Hi,
I'm using simple functions to format data from the things network and to save it locally and to forward it to influx database.

Flow works some time for few days, some time for few hours and I just see that data is not being saved to local file or to influx database.

In syslog I see this error that starts to show up: "TypeError: Cannot read property '0' of null"

After restarting node-red service, flows are reloaded and everything works as expected.

Any ideas what happens and how to fix this issue?

Hi @valent

can you share more of the log around the time of the error message? The full error should include the id of the node that is logging the error. With that you can begin to narrow down what is happening.

1 Like

Here is how full log looks like:

Nov 28 14:59:24 stara-pekara Node-RED[12182]: 28 Nov 14:59:24 - [info] Starting flows
Nov 28 14:59:25 stara-pekara Node-RED[12182]: 28 Nov 14:59:25 - [info] Started flows
Nov 28 14:59:26 stara-pekara Node-RED[12182]: 28 Nov 14:59:26 - [info] [ttn app:75990f2f.32c4] Connected to TTN application grad-osijek-brojac-pekara
Nov 28 17:32:43 stara-pekara Node-RED[12182]: 28 Nov 17:32:43 - [error] [function:wifi and bluetooth] TypeError: Cannot read property '0' of null
Nov 28 17:32:43 stara-pekara Node-RED[12182]: 28 Nov 17:32:43 - [error] [function:log to file] TypeError: Cannot read property '0' of null
Nov 28 20:08:42 stara-pekara Node-RED[12182]: 28 Nov 20:08:42 - [error] [function:log to file] TypeError: Cannot read property '0' of null
Nov 28 20:08:42 stara-pekara Node-RED[12182]: 28 Nov 20:08:42 - [error] [function:wifi and bluetooth] TypeError: Cannot read property '0' of null
Nov 28 20:08:42 stara-pekara Node-RED[12182]: 28 Nov 20:08:42 - [error] [function:wifi only] TypeError: Cannot read property '0' of null
Nov 28 20:08:42 stara-pekara Node-RED[12182]: 28 Nov 20:08:42 - [error] [function:format for ubidots] TypeError: Cannot read property '0' of null

Node-red was running on Raspberry and version of node was v12.13.1

I then installed Node-red on Debian server, node version is v10.17.0, moved flows to new server and I sat same error just once, and it didn't break the Node-red.

Not sure why but on RPI it was breaking every 1-2 hours :frowning:

I'll put in my two cents worth.

(There seems to be a spate of this sort of thing happening just now. Weird.)

I'm suspicious of the power supply.

Many a time it is simply overlooked.

Suggestion - if you will:
on the RasPi, install a program called vcgencmd.
So in the terminal/cli enter:
sudo apt install vcgencmd
There is also a node of that name: vcgencmd if you want to go down the NR road of tracking it.

This allows you to check if there is a power problem.

As it is using a dongle - though maybe even built in wifi if you are using a RP3 - could be causing problems.

Alas this is a tricky thing. Alas it is also painful doing all this stuff on a whim, but it is sometimes better to rule things out for sure rather than thinking they are ok.

I'll stop here, as I think I am now starting to rant.

1 Like