Error in Function Node


the 2nd function node is having code for decoder function.and msg.payload contains a buffer containing array of values.

Select the function node & export the flow JSON for that 1 node so we can have a look.

I suspect you pasted some code from a web page & managed to pick up a non printable character.

I see you are using JSON.parse and it fails. Try to debug the input to this node to be sure you are feeding valid JSON string to that function.

flows.json (4.4 KB)
Here is the file for all nodes
2)This file is for just 1 node
flows (1).json (538 Bytes)

This is code for decoding hexadecimal input which is the same as used in thingsnetwork for decoding the payload.I am sending data of Join packet, it is not regular report packets, so the converter can not decode it easily so i have used base64 node to convert it in buffer.

msg.payload is already a javascript object, so when you try to parse it it throughs an error.

Why are you trying to JSON.parse the incoming binary message ? I gave you the function yesterday - and you seem to have broken it... revert it to what I gave you.

this code didn't worked i tried it many times.

Why have you added that first function node - the base64 node expects a string... not json (that your function node is trying to create). you should just need mqtt -> base64 -> function -> debug


This is code for 1st function node.I will try without it and debug the output.
Also Here is exported flowsflows.json (4.4 KB)

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.