Why am I getting "Failed to load extension. Invalid value for 'content_security_policy'"?

I am trying to create a chrome extension. My manifest file is

{
    "name": "Alert-Beep",
    "action": {},
    "manifest_version": 3,
    "version": "0.1",
    "description": "Beeps if alert() is called",
    "content_security_policy": "script-src 'self'; object-src 'self'",
    "permissions": [
    "activeTab",
    "scripting"
    ],
    "content_scripts": [
    {
        "matches": ["https://*.com/*"],
        "js": ["alert-beep.js"],
        "run_at": "document_start"
    }
    ]
}

Loading the extension fails with the message

Failed to load extension
File
~\alert-beep
Error
Invalid value for 'content_security_policy'.
Could not load manifest.

What am I doing wrong?


Solution 1:

An additional example that helped me:

manifest v3

"content_security_policy": {
    "extension_pages": "script-src 'self'; object-src 'self'; script-src-elem 'self' 'unsafe-inline' https://music.yandex.ru/;"
}

Solution 2:

I've looked into CSP for chrome extensions (go here to learn more for manifest v3).

Use

"content_security_policy": {
  "extension_pages": "script-src 'self'; object-src 'self'"
}