How to use webrequest with manifest V3?

I’m trying to make webrequest API work with manifest V3.

For quick validation, I create a simple extension, including only two files:

manifest.json

{
  "manifest_version": 3,
  "version": "0.0",
  "name": "DemoWebext",
  "permissions": ["webRequest"],
  "host_permissions": ["<all_urls>"],
  "background": {
    "scripts": ["bg.js"]
  },
  "browser_specific_settings": {
    "gecko": {
      "id": "DemoWebext@x"
    }
  }
}

bg.js

browser.webRequest.onBeforeRequest.addListener(function (requestDetails) {
  console.log(requestDetails)
}, {
  urls: ["<all_urls>"],
})

console.log('Hello')

Load this simple extension via about:debugging (Firefox 116.0.2) and its console prints no more log but “Hello”. However, if I rewrite manifest.json into manifest V2, this extension works well.

What’s the problem with this simple extension? Is it supported to use webrequest API with manifest V3? (At least, these methods seem callable…)

Did you granted host permissions manually?
This may be again one of those many many cases reported here where the permissions for hosts are not granted on install time in MV3.

I think you can manually grant it in the about:addons page (click your addon and then switch to Permissions tab).