I’m using node module to advertise a service but it comes back with no addresses when using bonjour browser on mac, if I discover locally on the box it returns the information correctly.

Any recommendations?

Hi Brice,

That module is mainly used in Resin within the CLI to search for local devices using Bonjour/mDNS, rather than to advertise them. The device itself already has Avahi configured in the OS, so you’ll find this works much more reliably if you configure the OS’s Avahi instance using D-Bus, rather than starting your own competing mDNS service on the same device.

There’s a Python example of a full project doing exactly that here:

It looks like you’re using JS though, is that right? may be of interest. That’s JS (well, coffeescript) code to query Avahi over D-Bus when searching for devices, but you should be able to get some working logic to publish devices too from there.

Awesome, thanks @pimterry will give this a try, I’m trying to have a consistent build that works on mac and in my container, hence why I was keen to use the bonjour module. I’ve tested today and it’s working ok even if the package is fairly recent.

@pimterry is there a way to disable avahi on the host container via dBus or other method? Would this cause issues? Would rather use my own broadcasting service.

@pimterry I’m using dbus-native to talk to Avahi via dbus but can’t get the interface, any idea what’s going on please?

const dbus = require('dbus-native');
const bus = dbus.systemBus();
const service = bus.getService('org.freedesktop.Avahi').getInterface('/', 'org.freedesktop.Avahi.Server', (err, interface) => {

I get a No such interface found error.

@brice Have you set the DBUS address to use the host DBUS? That would cause this. You need to run something like export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket beforehand.

The example python project for this has some details at, and there’s docs on this specifically here:

To answer your previous question as well:

is there a way to disable avahi on the host container via dBus or other method? Would this cause issues? Would rather use my own broadcasting service.

I’ve been talking to some of the team to see if we have any solutions here, but right now I’m not aware of any way to do that.

I’ve setup the env, but still getting the same error. Tried with dbus and dbus-native.

If I use dbus-send I can talk to avahi but dbus-send doesn’t support array of array of bytes which is required when broadcasting a new service on Avahi.

@pimterry I’m still stuck on this one, that’s the code I’m using:

const dbus = require('dbus-native')

const bus = dbus.systemBus();
bus.getService('org.freedesktop.Avahi').getInterface('/', 'org.freedesktop.Avahi.Server', (err, interface) => {


DBUS_SYSTEM_BUS_ADDRESS is correctly set, and I keep getting a No such interface found error from dbus-native. I must be missing something obvious, any idea please?

PS: happy birthday :sweat_smile:

For some reasons the list of methods is empty, even when using dbus-send:

dbus-send --system --print-reply --dest=org.freedesktop.Avahi / org.freedesktop.DBus.Introspectable.Introspect
method return sender=:1.4 -> dest=:1.93 reply_serial=2
   string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"

Any progress on this issue? I am running into it as well.

It looks like the Avahi interface description document is not present under /usr/share/dbus-1/interfaces/. The dbus-native library relies on DBus’ introspection description documents to allow access to the interfaces. I’m not sure if there is a way to add it since the location is in the read-only image.

@samjrdn my work around was to install avahi-utils on the box and use that to broadcast using avahi-publish

Hi @brice,

What is the device type that you noticed this issue at?

Using the IntelNUC image on a Zotac computer.

Thank you @brice, I have created an issue at where you can track progress.

Awesome thanks