Payload formatter runtime error messages

Dear forum members,

I had some trouble using a payload formatter for the Milesight UC300. This is a Lora-node that can read multiple direct inputs and up to 32 modbus sensors. The UC300 was equipped with 6 sensors, but only the first three where reported by the payload decoder.

After some research I found that there is a little yellow traffic sign in the source code of the payload formatter installed from the repository. This says: Too many errors (76% scanned). The repository version has about 7 kB and 195 lines of code and this is the only error hint.

There is another version of the formatter on github:

This has about 550 lines of code and 20 kB. It shows some more errors. The last one was again: Too many errors (32% scanned). This version seems to work properly.

Can anybody explain, what the message means and why I get the message as the first and only error? It seems the repository formatter somehow crashes at runtime, but this is not reported. At least, I cannot see any reason why the payload is not processed completely.

Is there any way to debug a payload decoder? I tried to test the decoder on some other JS playground, but all code runs properly here. So, it seems there are some differences in the environment.

Yup, you can do it on your desktop computer, here’s an example: TypeError: Value is not an object: undefined at apply (native) when trying to decode payload - #4 by descartes

There are, as detailed in the docs: JavaScript | The Things Stack for LoRaWAN

1 Like