# No dubug message in sidebar when using readBigInt64BE

**URL:** <https://discourse.nodered.org/t/no-dubug-message-in-sidebar-when-using-readbigint64be/36040>\
**Category:** General\
**Created:** [17 November 2020 08:16 UTC](https://discourse.nodered.org/t/no-dubug-message-in-sidebar-when-using-readbigint64be/36040 "2020-11-17T08:16:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![izebigyo](https://avatars.discourse-cdn.com/v4/letter/i/d9b06d/32.png) [@izebigyo](https://discourse.nodered.org/u/izebigyo)\
**Post date:** [17 November 2020 08:16 UTC](https://discourse.nodered.org/t/no-dubug-message-in-sidebar-when-using-readbigint64be/36040/1 "2020-11-17T08:16:12Z")

</div>

Hello,

I discovered an interesting behavior in node red.  
I'm using the node-red-contrib-modbus pallete and its modbus-server node to read data from a modbus tcp. Debugging its output with the debug node works fine. When adding a function debugging keeps working until I add the following command code line:

```auto
var int1 = bufint.readBigInt64BE(0);

```

the method shown here refers to this package: [https://nodejs.org/api/buffer.html](https://nodejs.org/api/buffer.html)

And the interesting thing is. Although the debug node is not showing anything the following code is writing the right result to the console. So node red keeps working.

```auto
console.log(int1)

```

My test flow for testing:

```auto
[{"id":"94000c64.5b6b5","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"b93a9741.e0d148","type":"modbus-server","z":"94000c64.5b6b5","name":"","logEnabled":false,"hostname":"0.0.0.0","serverPort":10502,"responseDelay":100,"delayUnit":"ms","coilsBufferSize":"0","holdingBufferSize":"5","inputBufferSize":"1","discreteBufferSize":"0","showErrors":false,"x":600,"y":160,"wires":[["a0675782.ca5198"],[],[],[],[]]},{"id":"dceda277.20686","type":"function","z":"94000c64.5b6b5","name":"","func":"msg.payload = { 'value': msg.payload, \n'register': 'holding', \n'address': 2, \n'disableMsgOutput' : 0 }; \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":340,"y":160,"wires":[["b93a9741.e0d148"]]},{"id":"e7bd997.b998968","type":"inject","z":"94000c64.5b6b5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2.1","payloadType":"num","x":110,"y":160,"wires":[["dceda277.20686"]]},{"id":"a0675782.ca5198","type":"function","z":"94000c64.5b6b5","name":"","func":"var buf = msg.payload;\nvar bufint = buf.subarray(0,8);\nvar int1 = bufint.readBigInt64BE(0);\nvar msg1 = { payload : int1 };\nconsole.log(msg1)\nreturn msg1;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":140,"wires":[["e4a42523.50cee8"]]},{"id":"e4a42523.50cee8","type":"debug","z":"94000c64.5b6b5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070,"y":140,"wires":[]}]

```

Thank you in advance for your help!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 November 2020 08:34 UTC](https://discourse.nodered.org/t/no-dubug-message-in-sidebar-when-using-readbigint64be/36040/2 "2020-11-17T08:34:34Z")

</div>

This is a known issue.

The problem is with JSON.stringify (or to be more accurate the issue is with BigInt being introduced after the JSON specification). If I am not mistaken, JSON.stringify is used to serialise debug messages for sending from node-red server to client & thus cannot handle `BigInt` data type.

Demo of node.js trying to stringify a bigInt of `1` (`1n` is a BigInt with value of `1`)...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/5/55dfb5d92ed04ed5fa869571f1ee0bc7b8994f6d.png)

[Here](https://www.google.com/search?q=json+stringify+bigint) is a little light reading on the subject.

---

<div class="post-metadata">

**Author:** ![izebigyo](https://avatars.discourse-cdn.com/v4/letter/i/d9b06d/32.png) [@izebigyo](https://discourse.nodered.org/u/izebigyo)\
**Post date:** [17 November 2020 08:48 UTC](https://discourse.nodered.org/t/no-dubug-message-in-sidebar-when-using-readbigint64be/36040/3 "2020-11-17T08:48:17Z")

</div>

Thank you a lot for this fast and detailed answer! It works fine indeed with the 32 bit conversion. I'll think about whether 64 bits are really necessary for my application.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 December 2020 08:48 UTC](https://discourse.nodered.org/t/no-dubug-message-in-sidebar-when-using-readbigint64be/36040/4 "2020-12-01T08:48:18Z")

</div>

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