Log raw payload

Is there a way to log the payload before the decoder gets it?

I have a problem writing a decoder where it sometimes throws a error on som payloads and i want to se what the payload looks like that does this?

level=error msg=“decode payload error” application_id=20 codec=CUSTOM_JS dev_eui=70b3d5326000e119 error=“execute js error: js vm error: TypeError: Cannot access member ‘toString’ of undefined” f_cnt=38 f_port=2

Of course i want the decoder running as usual but still logg the payload as iam unable to find the payloads in any logs…

I believe you would still get the up event, but then without the decoded payload :slight_smile: In case the payload successfully decodes the payload, you also get both the raw + decoded payload.

Yes but without the raw payload its difficult knowing what makes it do the error as it works most of the times…

But if you receive the uplink event even in case of a codec error, then you have all the information haven’t you?

The uplink event contains both the data field (which is the raw payload) + uplink frame-counter. With that information you can trace the error log to the exact payload.

Of course! You are correct as always :slight_smile: i had completely missed that they came in the mqtt… NICE!! now i can proceed to locate where things go wrong.

Thank you!!

2 Likes