dbusjs / node-dbus-next

🚌 The next great dbus library for node
https://www.npmjs.com/package/dbus-next
155 stars 52 forks source link

Multiple D-Bus errors occur (application runs fine, however) #118

Closed millerH112 closed 1 year ago

millerH112 commented 1 year ago

Thanks for the great library!

I have an electron application that utilizes this library to create a bluetooth connection. While it works, I receive a lot of dbus errors when listening to any bluez notifications. It seems like in this case, there are more errors that occur when there are more bluetooth devices found in the area.

Here is how I add a listener: org_bluez_object_manager_interface.on(INTERFACES_ADDED, listen_to_bluez_obj_manager_interfaces_added)

And the resulting error that occurs: Dec 12 16:17:44 myUsername dbus-daemon[1157]: [system] Rejected send message, 0 matched rules; type="error", sender=":1.396" (uid=1000 pid=38491 comm="/tmp/.mount_myapplication4s7vxJ/myapplication " label="unconfined") interface="(unset)" member="(unset)" error name="com.github.dbus_next.Error" requested_reply="0" destination=":1.394" (uid=0 pid=38966 comm="/usr/lib/bluetooth/bluetoothd " label="unconfined")

Going through the logs (journalctl), the above error can be spammed with it quite a bit.

Weirdly enough, this issue does not seem to present itself if running the bluetooth script with just node - it seems to only present itself when running the electron application itself.

I'll find some time and post a minimum reproducible example as soon as I am able to.

millerH112 commented 1 year ago

Closing as this was a result of my own code.

When listening to bluez object manager interfaces added, I was checking the following: function listen_to_bluez_obj_manager_interfaces_added(path, changed, invalidated){ if(changed["org.bluez.GattCharacteristic1"]["UUID"].value === MY_CUSTOM_BLUETOOTH_GATT_CHARACTERISTIC_UUID){ gatt_characteristic_found = true; gatt_characteristic_path = path; } }

bus.js in node-dbus-next would then send the error due to some added interfaces not having the "org.bluez.GattCharacteristic1" property.