# runtime.sendNativeMessage() doesn't work

**URL:** <https://discourse.mozilla.org/t/runtime-sendnativemessage-doesnt-work/150082>\
**Category:** Development\
**Created:** [November 4, 2026, 5:38pm UTC](https://discourse.mozilla.org/t/runtime-sendnativemessage-doesnt-work/150082 "2026-11-04T17:38:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sabia](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sabia](https://discourse.mozilla.org/u/sabia)\
**Post date:** [November 4, 2026, 5:38pm UTC](https://discourse.mozilla.org/t/runtime-sendnativemessage-doesnt-work/150082/1 "2026-11-04T17:38:38Z")

</div>

edit: it seems my “native” program isn’t working, the official example doesn’t work when it uses my ping\_pong implementation. wait until I sort this out.

hey fellas

I’m unable to `await` the `Promise` returned by `runtime.sendNativeMessage()`.

is it skill issue, or did I find a bug in Firefox? can you pinpoint my mistake, please?

I’m using Linux. version of Firefox: 153.6.0esr (64-bit)

pls look at my code:

> **[GitHub - bottle2/my-extension at 896b4eb13f8e50e4565b7df6a68a6f93ce8e8df7](https://github.com/bottle2/my-extension/tree/896b4eb13f8e50e4565b7df6a68a6f93ce8e8df7)**
>
> 896b4eb13f8e50e4565b7df6a68a6f93ce8e8df7

so basically running `$ make` will install the native app manifest under `~/.mozilla` and compile the echo program

I initially followed these two tutorials:

> **[Your first extension - Mozilla | MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension)**
>
> This article walks through creating an extension for Firefox, from start to finish. The extension adds a red border to any pages loaded from mozilla.org or any of its subdomains.

> **[Your second extension - Mozilla | MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_second_WebExtension)**
>
> The Your first extension tutorial introduced you to the basic process of writing an extension. In this article, you write a slightly more complex extension that demonstrates additional APIs.

then I adapted my code from second tutorial to apply everything from this tutorial:

> **[Native messaging - Mozilla | MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging)**
>
> Native messaging enables an extension to exchange messages with a native application, installed on the user's computer. The native messaging serves the extensions without additional accesses over the web.

the only divergence is as follows. this tutorial on “Native messaging” says this:

> Native messaging cannot directly be used in content scripts. You must do it indirectly via background scripts).

however, I call `runtime.sendNativeMessage()` in a “popup script”, created after following the tutorial “Your second extension”. according to the following page:

> **[Anatomy of an extension - Mozilla | MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Anatomy_of_a_WebExtension)**
>
> An extension consists of a collection of files, packaged for distribution and installation. This article describes the files that may be present in an extension.

> All of these are Extension pages. Unlike a normal web page, your extension’s JavaScript can use the same privileged WebExtensions APIs as your background script.

referring to “sidebar”, “popup” and “options”. which means my JavaScript run in the popup should be able to call `runtime.sendNativeMessage()`

thanks in advance, I’m eager for feedback
