# Mosca Error Expected "schema" to be an object or boolean

**URL:** <https://discourse.nodered.org/t/mosca-error-expected-schema-to-be-an-object-or-boolean/37289>\
**Category:** General\
**Created:** [10 December 2020 09:42 UTC](https://discourse.nodered.org/t/mosca-error-expected-schema-to-be-an-object-or-boolean/37289 "2020-12-10T09:42:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vongomben](https://avatars.discourse-cdn.com/v4/letter/v/a4c791/32.png) [@vongomben](https://discourse.nodered.org/u/vongomben)\
**Post date:** [10 December 2020 09:42 UTC](https://discourse.nodered.org/t/mosca-error-expected-schema-to-be-an-object-or-boolean/37289/1 "2020-12-10T09:42:34Z")

</div>

Hi everybody.  
I'm teaching IoT to a class of students, which are experiencing a problem in the MQTT connection.  
MQTT (mosca) node is not successfully connecting and is giving this error:

```auto
schemaerror: Expected "schema" to be an object or boolean

```

Apparently is related to jsonschema? We found [this](https://stackoverflow.com/questions/64189045/node-js-mosca-broker-error-expected-schema-to-be-an-object-or-boolean).

The interesting thing is that just 6 out of 20 are experiencing the issue, possibly unrelated to the version of npm or node js (nothing changed when updated)

Thanks in advance for your help!

Edit1: a quick fix found by a student is shifting to Aedes[1]

[1] [https://github.com/moscajs/aedes](https://github.com/moscajs/aedes)

---

<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:** [10 December 2020 10:32 UTC](https://discourse.nodered.org/t/mosca-error-expected-schema-to-be-an-object-or-boolean/37289/2 "2020-12-10T10:32:20Z")

</div>

mosca is a dead project & superseded by aedes.

How are you running a broker in your class lessons? - a shared broker (amongst students) I assume (for interaction)

Are you running aedes (formerlly mosca) under nodejs from command line?

If so, why not use just use the node-red broker node [node-red-contrib-aedes](https://flows.nodered.org/node/node-red-contrib-aedes) - or for that matter install mosquito in a central location?

---

<div class="post-metadata">

**Author:** ![vongomben](https://avatars.discourse-cdn.com/v4/letter/v/a4c791/32.png) [@vongomben](https://discourse.nodered.org/u/vongomben)\
**Post date:** [10 December 2020 14:37 UTC](https://discourse.nodered.org/t/mosca-error-expected-schema-to-be-an-object-or-boolean/37289/3 "2020-12-10T14:37:25Z")

</div>

Hi Steve.  
Thanks for the answer.  
We did use aedes, yet everybody on his own node-red instance.  
What we are trying to achieve are several interaction between a selfhosted Node-RED cloud and and Arduino MKR1010.

While Aedes is properly working within Node-RED, Arduino is having an hard time to connect to the broker.  
I guess this problem is not related or addressed to this forum though.

Thanks for the quick answer!

---

<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:** [10 December 2020 14:42 UTC](https://discourse.nodered.org/t/mosca-error-expected-schema-to-be-an-object-or-boolean/37289/4 "2020-12-10T14:42:20Z")

</div>

> [@vongomben](#):
>
> We did use aedes, yet everybody on his own node-red instance.

so is that `aedes` or `node-red-contrib-aedes`?

> [@vongomben](#):
>
> Arduino is having an hard time to connect to the broker

This should work (aedes is a very reasonable broker) - assuming devices can contact the aedes IP:PORT (same network / no firewalls etc)

but again why not have a mosquito install?

---

<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:** [8 February 2021 14:42 UTC](https://discourse.nodered.org/t/mosca-error-expected-schema-to-be-an-object-or-boolean/37289/5 "2021-02-08T14:42:22Z")

</div>

Closed on 8 February 2021 14:42 UTC

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