web-ext
web-ext copied to clipboard
`web-ext run` not working for manifest version 3
Is this a feature request or a bug?
I updated my manifest version to version 3 and I can't use web-ext
any longer.
What is the current behavior?
$ web-ext run
Applying config file: ./package.json
Running web extension from
Use --verbose or open Tools > Web Developer > Browser Console to see logging
o: installTemporaryAddon: Error: Error: Could not install add-on: Error: Unsupported manifest version: 3
at b.installTemporaryAddon (/usr/local/lib/node_modules/web-ext/dist/web-ext.js:1:43054)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at a.startFirefoxInstance (/usr/local/lib/node_modules/web-ext/dist/web-ext.js:1:29874)
at a.run (/usr/local/lib/node_modules/web-ext/dist/web-ext.js:1:27821)
at async Promise.all (index 0)
at x.run (/usr/local/lib/node_modules/web-ext/dist/web-ext.js:1:5302)
at $ (/usr/local/lib/node_modules/web-ext/dist/web-ext.js:1:10140)
at R.execute (/usr/local/lib/node_modules/web-ext/dist/web-ext.js:1:64498)
error Command failed with exit code 1.
What is the expected or desired behavior?
Version information (for bug reports)
- Firefox version: 97.0
- Your OS and version: macOS 10.15.7
- Paste the output of these commands:
node --version && npm --version && web-ext --version
v17.4.0 8.3.1 6.6.0
It's a feature request I guess, because its clearly mentioned in error message unsupported manifest version: 3
I guess there should be work in progress
o: installTemporaryAddon: Error: Error: Could not install add-on: Error: Unsupported manifest version: 3
Perhaps an option like --manifest <path>
could be added, so we can use a v2 manifest instead, when testing on Firefox.
I guess already there are many switches, there should be a hack within them, and even if there is not, it make sense to fix it with some npmscript / waiting for firefox to adopt it then migrating to v3
Also it seems MV3 based extensions with service worker are not supported, e.g.
> web-ext run --browser-console --firefox-preview -t firefox-desktop -s extension
Applying config file: ./package.json
Running web extension from /home/----------------------/extension
Configuring Firefox preferences for Manifest V3
Setting custom Firefox preferences: {
"extensions.manifestV3.enabled": true
}
Use --verbose or open Tools > Web Developer > Browser Console to see logging
WebExtError: installTemporaryAddon:
Error: Error: Could not install add-on at '/home/----------------------/extension/extension':
Error: background.service_worker is currently disabled
at RemoteFirefox.installTemporaryAddon (file:///home/----------------------/extension/node_modules/web-ext/lib/firefox/remote.js:100:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async FirefoxDesktopExtensionRunner.startFirefoxInstance (file:///home/----------------------/extension/node_modules/web-ext/lib/extension-runners/firefox-desktop.js:227:27)
at async FirefoxDesktopExtensionRunner.run (file:///home/----------------------/extension/node_modules/web-ext/lib/extension-runners/firefox-desktop.js:45:5)
at async Promise.all (index 0)
at async MultiExtensionRunner.run (file:///home/----------------------/extension/node_modules/web-ext/lib/extension-runners/index.js:72:5)
at async run (file:///home/----------------------/extension/node_modules/web-ext/lib/cmd/run.js:180:3)
at async Program.execute (file:///home/----------------------/extension/node_modules/web-ext/lib/program.js:285:7)
at async file:///home/----------------------/extension/node_modules/web-ext/bin/web-ext.js:13:1
Also it seems MV3 based extensions with service worker are not supported, e.g.
Firefox doesn't support service workers in extensions yet.
As a workaround, you can create two manifests, one with background: { service_worker: 'path.js' }
for Chrome and one with background: { scripts: ['path.js'] }
for Firefox.
In Firefox, we have decided to support Event Pages in MV3, and our developer preview will not include Service Workers (we’re continuing to work on supporting these for a future release).
I'll wait for service worker support, so I don't have to maintain two code-bases
In Firefox, we have decided to support Event Pages in MV3, and our developer preview will not include Service Workers (we’re continuing to work on supporting these for a future release).
I'll wait for service worker support, so I don't have to maintain two code-bases
In Firefox, we have decided to support Event Pages in MV3, and our developer preview will not include Service Workers (we’re continuing to work on supporting these for a future release).
I'll wait for service worker support, so I don't have to maintain two code-bases
The background service worker support in Firefox is planned but there is still more work needed, we decided to prioritized the event page support because:
- it provides the same resiliency to extension process termination that the background service worker would have allowed
- but it still supports a number of DOM API that are not available in a service worker global and would prevent some extension use cases to be covered like they were in manifest_version 2 extensions
- we plan to enable event page for manifest_version 2 extensions in one of the upcoming Firefox releases to make it easier to gradually transition the extensions code base from manifest_version 2 to manifest_version 3
- Apple will also support event pages in Safari WebExtensions manifest_version 3 implementation
In terms of compatibility, if your background script doesn't use anything that is only available in a service worker global (or use those only if runtime detection determined that they are available), manifest_version 3 extensions should be able to share the same code base and just use two different manifests.
With the forced switch to manifest v3 just around the corner, I'd really like to begin testing manifest v3 support... Any updates on this/plans? We only have like 2-3 months before chrome forces the switch if I understood the announcement right.
@ChadBailey what are you looking for exactly? For Firefox, the following command should work:
web-ext run --firefox-preview
I must be doing something wrong, I still get the explicit failure that manifest version is unsupported. I'll take a second look at it
Which web-ext version do you use?
@willdurand I'm having the same issue. Currently on 7.2.0
for web-ext
. Here's my WIP draft, if that's helpful.
@willdurand I'm having the same issue. Currently on
7.2.0
forweb-ext
. Here's my WIP draft, if that's helpful.
In this case, the problem was that the manifest.json
was invalid in MV3 and that's why it couldn't work with web-ext run
. The error said "could not install" only, though.. I am not sure we can surface any other errors.
web-ext lint
gives more information (errors).
I am going to close this issue now given the CLI flag works and we can run valid MV3 add-ons.
I apologize for wasting your time, I imagine my issues were local only. I still haven't gotten it working properly but the current issues I'm experiencing are completely unrelated to this.
@ChadBailey feel free to open new issues if you identify issues that might be fixed on the web-ext
side. Also, if you have other issues, maybe you can try to get some help on Matrix.