chrome.tabs.sendMessage now failing in Chrome 99 and MV3

1,606 views
Skip to first unread message

Sonny Chee

unread,
Mar 7, 2022, 11:10:37 PM3/7/22
to Chromium Extensions
Hey Guys,

I'm in the process of migrating my MV2 extension to MV3 and I notice that all of my calls to chrome.tabs.sendMessage are failing with the message:

"Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist.”

These calls all worked before. Anyone else seen this issue?

Sonny Chee

unread,
Mar 7, 2022, 11:34:46 PM3/7/22
to Chromium Extensions, Sonny Chee
I also tried replacing all of my sendMessage with connect/postMessage calls with no better outcome.
ie:
    var port = chrome.tabs.connect( tab.id );
    port.postMessage( {selection_text: info.selectionText} );

With this change I am getting an additional error message:

Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
Error in event handler: Error: Attempting to use a disconnected port object
    at chrome-extension://ffjganibfaebgbaliahcdngeomnmeaba/overrides/platform_background.js:15:10


Any suggested workaround would be greatly appreciated.

wOxxOm

unread,
Mar 8, 2022, 12:55:22 PM3/8/22
to Chromium Extensions, sonny...@gmail.com
I've posted workarounds in an older post about this problem:

Sonny Chee

unread,
Mar 8, 2022, 4:37:00 PM3/8/22
to Chromium Extensions, wOxxOm, Sonny Chee
Thanks, wOxxOm, that was exactly what I needed.
Reply all
Reply to author
Forward
0 new messages