” or ‘activeTab’ permission is required

I’m trying to capture the visible tab, but every time I try that, I get this error:
'<all_urls>' or 'activeTab' permission is required.

My code is below:

background.js

chrome.tabs.captureVisibleTab((dataUrl) => {
    console.log(dataUrl)
});

manifest.json

{
    "manifest_version": 3,
    "name": "AppName",
    "description": "A early-access extension.",
    "version": "1.0",
    "permissions": [
        "activeTab"
      ],

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

      "action": {},

      "content_scripts": [
        {
          "matches": ["<all_urls>"],
          "js": ["content-script.js"] 
        }
      ],
    
      "host_permissions": [
        "http://*/*",
        "https://*/*"
      ]
  }

I tried changing the background code, I tried changing “service_worker” to “script” but it didn’t work.
Hopefully someone can help me on this.

Thanks.