# Node-red-contrib-meross crashing node-red

**URL:** <https://discourse.nodered.org/t/node-red-contrib-meross-crashing-node-red/84514>\
**Category:** General\
**Created:** [13 January 2024 00:15 UTC](https://discourse.nodered.org/t/node-red-contrib-meross-crashing-node-red/84514 "2024-01-13T00:15:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoppolig](https://avatars.discourse-cdn.com/v4/letter/z/8797f3/32.png) [@zoppolig](https://discourse.nodered.org/u/zoppolig)\
**Post date:** [13 January 2024 00:15 UTC](https://discourse.nodered.org/t/node-red-contrib-meross-crashing-node-red/84514/1 "2024-01-13T00:15:51Z")

</div>

I installed the meross node to control some MSS310 plugs. I followed all instructions and got the token and IP of the plug (which is connected, pings fine, and is controlled well by the app). Issue is, when try to send msg.payload TRUE to the node, the node-red server crashes and restarts with this error log:

```auto
13 Jan 01:08:55 - [red] Uncaught Exception:
13 Jan 01:08:55 - [error] SyntaxError: Unexpected token P in JSON at position 0
    at JSON.parse (<anonymous>)
    at Request._callback (/home/pi/.node-red/node_modules/node-red-contrib-meross/meross/smartplug-control.js:68:19)
    at self.callback (/home/pi/.node-red/node_modules/request/request.js:185:22)
    at Request.emit (node:events:517:28)
    at Request.emit (node:domain:489:12)
    at Request.<anonymous> (/home/pi/.node-red/node_modules/request/request.js:1154:10)
    at Request.emit (node:events:517:28)
    at Request.emit (node:domain:489:12)
    at IncomingMessage.<anonymous> (/home/pi/.node-red/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (node:events:631:28)
    at IncomingMessage.emit (node:events:529:35)
    at IncomingMessage.emit (node:domain:489:12)
    at endReadableNT (node:internal/streams/readable:1400:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.

```

node-red version 3.1.3  
node-red-contrib-meross 2.2.1  
Node.js v18.19.0  
Running on a Raspberry Pi 4B with OS Debian GNU/Linux 12 (bookworm)

Any help appreciated

---

<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:** [13 January 2024 04:21 UTC](https://discourse.nodered.org/t/node-red-contrib-meross-crashing-node-red/84514/2 "2024-01-13T04:21:52Z")

</div>

> [@zoppolig](#):
>
> node-red-contrib-meross

It looks like the node is getting a non JSON response then tries to parse it into an object but it does not have suitable error handling and therefore crashes node-red.

In short, a node package should handle all errors (especially in async/callback code)

You should raise a new issue here: [Issues · dehsgr/node-red-contrib-meross · GitHub](https://github.com/dehsgr/node-red-contrib-meross/issues) and provide the stack trace and a link back to this post for x-ref

---

<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:** [13 March 2024 04:22 UTC](https://discourse.nodered.org/t/node-red-contrib-meross-crashing-node-red/84514/3 "2024-03-13T04:22:44Z")

</div>

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