Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

chrome.runtime.getContexts is undefined

129 views
Skip to first unread message

Gaurang Tandon

unread,
Sep 27, 2024, 7:01:40 AM9/27/24
to Chromium Extensions
Hi! We're seeing this error recently TypeError: chrome.runtime.getContexts is not a function. It happened only on Chrome 128 so far. It happens only when the service worker starts up. This issue only affects our latest extension version - that is being currently rolled out. It also started happening when we released our latest extension version at 1%. Based on that, I think the issue only happens on extension auto-update (but I am not sure).

To be clear, this issue happens very rarely, and we have not been able to reproduce it. Has any other user faced this issue? Is this is a known issue by the Chromium team?

Best,
Gaurang

woxxom

unread,
Sep 27, 2024, 12:15:58 PM9/27/24
to Chromium Extensions, Gaurang Tandon
Sounds like the bug reported several months ago about `chrome` being uninitialized randomly at the startup of the service worker. I guess you can retry like this:

(function init() {
  if (!self.chrome?.tabs) return setTimeout(init);
  // your main code here
  // ........
})();

P.S. Yet another bug in MV3 service worker that realistically may take years to fix, just like it happened with similar random bugs. It also doesn't help that apparently it's more important to have chromium developers work for the past five months on UI and functionality that disables MV2 than try and fix bugs or improve declarativeNetRequest further to allow reviving the soon-to-be-dead convenient extensions based on webRequestBlocking for which there's either no workaround or it's too inconvenient or too unreliable to be usable.
Reply all
Reply to author
Forward
0 new messages