Unrecognized manifest key 'service_worker'

2,987 views
Skip to first unread message

Kent Brewster

unread,
Aug 14, 2019, 6:10:00 PM8/14/19
to Chromium Extensions
Hi, folks. I am responsible for a Chrome extension with over ten million users. Our extension makes heavy use of a background script, which will be going away with manifest v3. 

I am trying to get to the point where I can do useful work, but so far it has evaded me.

I am testing on Chrome Canary, currently 78.0.3882.0.

When I drag the current production version into chrome://extensions all is good, because it's manifest v2.

When I change my manifest version to 3 I get a pop-up error:

The "background.scripts" key cannot be used with manifest_version 3. Use the "service_worker" key instead.

Changing this:

  "background": {
    "scripts": ["background.js"]
  },

... to this:

  "service_worker": {
    "scripts": ["background.js"]
  },

... loads without a pop-up error but gets me two errors:

1) Unrecognized manifest key 'service_worker'.

2) The maximum currently-supported manifest version is 2, but this is 3. Certain features may not work as expected.


Reading the entrails here:


... suggests it's going to be service_worker.script and not scripts, so I try this:

  "service_worker": {
    "script": "background.js"
  },

This does not work, nor does this:

  "service_worker": {
    "script": ["background.js"]
  },

... nor this blind stab:

  "service_worker": "background.js"

Enabling Experimental Extension APIs, here: 

chrome://flags/#extension-apis

does not seem to help with either error, nor does enabling Experimental Web Platform Features from chrome:flags, like this:

chrome://flags/#enable-experimental-web-platform-features

I've also tried from the command line:

open -a "Google Chrome Canary" --args --enable-experimental-web-platform-features

... but I don't see it in chrome:flags, so I don't know if it's working or not.

Please, how can I get to the point where Chrome Canary sees service_worker as a valid manifest key?

Thanks very much,

--Kent

PhistucK

unread,
Aug 15, 2019, 2:05:51 AM8/15/19
to Kent Brewster, Chromium Extensions
I am not sure manifest version 3 can be tested yet at all.

PhistucK


--
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/0e69d51d-db30-484d-ac17-25d7489387e4%40chromium.org.

Devlin Cronin

unread,
Aug 15, 2019, 1:08:30 PM8/15/19
to Chromium Extensions
First off, thanks for your enthusiasm in getting started with experimentation early!

Manifest V3 is still very much in development, and there are many things that aren't quite ready yet.  In the coming weeks, we're hoping to be at a state where folks can begin experimenting with some of the bigger changes - including service worker-based background contexts.  There's still a few outstanding issues before we're quite ready to encourage folks to dive in.  We'll be sure to post in this group as development progresses.

As a very specific answer to this issue, the tentative format for service worker-based background contexts is:
```
{
  ...
  "background": {
    "service_worker": "script.js"
  }
}
```

But it's still a little early to test this (we haven't yet enabled extension API access in these SW contexts, so trying to use most APIs will result in an error).  Thanks for bringing up the confusion, though - I'll be sure to change the error message to indicate that the key is "background.service_worker" to hopefully avoid the confusion in the future.

Again, we'll keep everyone updated as we get further along and various aspects are ready for experimentation and testing.

Cheers,
- Devlin

Kent Brewster

unread,
Aug 15, 2019, 1:24:12 PM8/15/19
to Chromium Extensions
Excellent, thanks. Can you please say where the announcement will be made that Manifest V3 is ready to test?

--Kent

Kent Brewster

unread,
Aug 15, 2019, 1:54:47 PM8/15/19
to Chromium Extensions
Last followup and I'll stop on this thread. Trying this:

"background": {
"service_worker": "background.js"
}

... gets me an error message that makes sense:

'background.service_worker' requires trunk channel or newer, but this is the canary channel.

--Kent
> --
> 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/d4e2bec2-5c29-40b3-ad38-89406bc8ee63%40chromium.org.

Devlin Cronin

unread,
Aug 15, 2019, 4:05:02 PM8/15/19
to Chromium Extensions
Excellent, thanks. Can you please say where the announcement will be made that Manifest V3 is ready to test?
We will at least make the announcement in this group (chromium-...@chromium.org).  As development progresses, we will also be adding more documentation, transition guides, etc.

Last followup and I'll stop on this thread. Trying this:

  "background": {
    "service_worker": "background.js"
  }

... gets me an error message that makes sense:

  'background.service_worker' requires trunk channel or newer, but this is the canary channel.

Ah!  Sorry about that.  Currently, service worker-based background contexts are restricted to chromium builds.  We should be lifting that restriction (and allowing them on Canary) in the next week or so.  If you want to try building Chromium to experiment, the instructions are here (note that, while not terribly complicated, it is a multi-step non-trivial process).  I'll be sure to reply to this thread as well once the restriction is lifted, and we allow them in Canary (again, probably in the next week or so).

Cheers,
- Devlin

On Thursday, August 15, 2019 at 10:54:47 AM UTC-7, Kent Brewster wrote:
Last followup and I'll stop on this thread. Trying this:

  "background": {
    "service_worker": "background.js"
  }

... gets me an error message that makes sense:

  'background.service_worker' requires trunk channel or newer, but this is the canary channel.

--Kent

> To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
Reply all
Reply to author
Forward
0 new messages