Extension not working as It should.

112 views
Skip to first unread message

Jeremiah Oluwakoya

unread,
Feb 3, 2023, 11:56:12 AM2/3/23
to Chromium Extensions
Hi Everyone
I just had my extension successfully published, but there are a few issues.

Firstly, my background script seems to be void, it doesn't do what it supposed to and all efforts to click on the "Inspect views" link in the extensions details tab prove abortive.
please what can I do to resolve this issue??

Oliver Dunk

unread,
Feb 3, 2023, 11:59:28 AM2/3/23
to Jeremiah Oluwakoya, Chromium Extensions
Hi Jeremiah,

That seems odd. Are you comfortable sharing a link to the store listing?

Alternatively, if the extension is working locally and you want to troubleshoot in private, feel free to reach out here: https://support.google.com/chrome_webstore/contact/developer_support/
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/dd519de9-9705-48dc-84d0-da7f8a4ce8abn%40chromium.org.

Jeremiah Oluwakoya

unread,
Feb 3, 2023, 12:11:25 PM2/3/23
to Chromium Extensions, olive...@google.com, Chromium Extensions, Jeremiah Oluwakoya
Yeah I'm comfortable sharing the store listing

Oliver Dunk

unread,
Feb 3, 2023, 12:21:41 PM2/3/23
to Jeremiah Oluwakoya, Chromium Extensions
I took a quick look and I see `chrome.declarativeNetRequest.onRuleMatchedDebug` in the source, which is only supported in unpacked extensions. It looks like this may be causing an issue in registering the service worker and therefore the extension never gets properly setup.

It may be worth removing that/checking for any similar debug code?

It's unfortunate that this didn't show up until you had gone through the review process. I'd love to see if we can highlight that earlier.
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB

Jeremiah Oluwakoya

unread,
Feb 3, 2023, 12:58:42 PM2/3/23
to Chromium Extensions, olive...@google.com, Chromium Extensions, Jeremiah Oluwakoya
Wow .. I never thought that would be an issue, because in the docs it says that the method would be overlooked, so i didn't quite bother to take it out. I will do so and see if that works. Thank you 

wOxxOm

unread,
Feb 4, 2023, 11:39:40 AM2/4/23
to Chromium Extensions, mayjr...@gmail.com, olive...@google.com, Chromium Extensions
The documentation says "Only available for unpacked extensions". The word "available" means the very existence of the JS object, it doesn't mean availability of the functionality like an abstract concept, which is why your code throws on reading `undefined.addListener`. You can suggest disambiguating the documentation in their repository at the end of the page there's a bug link.

Until https://crbug.com/1241059 is implemented a possible solution is to use the optional chaining operator `?.`
chrome.declarativeNetRequest.onRuleMatchedDebug?.addListener((info) => {

There's also an overarching problem in ManifestV3 with seeing and debugging JS errors in the service worker when installing/reloading an extension. The lack of this feature signifies that ManifestV3 is still in the early pre-alpha phase for the most hardcore enthusiasts, especially since this was working properly in ManifestV2. I see only one slightly involved workaround, which probably should be added to the documentation:
  1. Open any visible page of your extension like the popup or options,

    or manually go to chrome-extension://xxxxx/manifest.json where xxxxx is the id of the extension shown in the webstore URL (cfjflhlmcklbjpggmcphmjiolakbmafa for the extension linked in the previous messages) as well as in chrome://extensions page when `developer mode` switch is enabled in the top right corner.

  2. Open devtools for this page by right-clicking on an empty space inside the page, then clicking `Inspect`

  3. Go to Console inside devtools and register the service worker explicitly by running the following code:
    navigator.serviceWorker.register((b=chrome.runtime.getManifest().background).service_worker, {type: b.type||'classic', scope: '/'})

  4. Now the console should show all the errors which you can click to go to the source code.

wOxxOm

unread,
Feb 4, 2023, 11:52:44 AM2/4/23
to Chromium Extensions, wOxxOm, mayjr...@gmail.com, olive...@google.com, Chromium Extensions
To disambiguate my own claim above regarding JS errors: currently Chrome shows only those JS errors in service worker that occurred after successful registration but not JS errors that prevent registration of the service worker. The workaround I explained is not obvious. When implemented properly, Chrome should allow clicking on the "Service worker (inactive)" label to open devtools where it would try to re-register the SW so we can see the errors and even debug them by setting breakpoints, then repeating the attempt.
Reply all
Reply to author
Forward
0 new messages