Native messaging host can not connect without developer mode enabled

138 views
Skip to first unread message

Liang Cui

unread,
May 4, 2025, 11:59:35 PM5/4/25
to Chromium Extensions
  1. With Developer Mode enabled, the extension connects to the native messaging host and works as expected.

  2. With Developer Mode disabled:

    • If you disable and then re‑enable the extension, it fails to connect to the native messaging host.

    • The Service Worker link disappears, so I can’t open the background console to view any logs.

  3. If start Chrome with --enable-logging and then enable the extension (while Developer Mode is off), I see a log message:

    The system cannot find the file specified.

    This error does not appear when Developer Mode is on, and in that case the native messaging host launches normally.


I haven’t found any documentation stating that native messaging requires Developer Mode, so this behavior looks like a possible bug.


Clip_20250505_114848..png
Clip_20250505_115238..png

Liang Cui

unread,
May 5, 2025, 2:57:56 AM5/5/25
to Chromium Extensions, Liang Cui
I have test on 2 computers, with 135 and 136 version, and verified by other users.

Liang Cui

unread,
May 7, 2025, 9:25:56 PM5/7/25
to Chromium Extensions, Liang Cui
Maybe the reason is call the following code without check if userScripts api aviliable.
chrome.userScripts.configureWorld({
        messaging: true
    });

The problem is, If devleoper mode disabled, I can not see any error message to identify the problem.

I have submitted a new version (klggbkjfmbonefdcfkiidhcmfjdfnepa), wish quick review to verify the problem.   Thanks.

woxxom

unread,
May 8, 2025, 2:07:29 AM5/8/25
to Chromium Extensions, Liang Cui
Accessing chrome.userScripts throws an exception if the developer mode is disabled. If you do it outside a function and don't have a try/catch wrapper, your entire script stops running at this point. The documentation could explain such consequences explicitly.
Reply all
Reply to author
Forward
0 new messages