Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.3K
Vistas
Chrome manifest v3: runtime.lastError specify 'func' and 'files'?

I'm searching for a solution everywhere and I can't find nothing about this error. I'm trying to "update" a Chrome extension to manifest v3 and I get this error:

Unchecked runtime.lastError: Exactly one of 'func' and 'files' must be specified

Does somebody have an idea on what can I do to solve this? Here is my manifest.json:

{
    "manifest_version": 3,
    "name": "Extension_Name",
    "description": "Extension_Desc",
    "version": "5.0",
    "icons": {
        "16": "/images/image16.png",
        "48": "/images/image48.png",
        "128": "/images/image128.png"
    },
    "action": {
        "default_popup": "popup.html"
    },
    "permissions": [
        "storage",
        "activeTab",
        "scripting",
        "tabs"
    ],
    "host_permissions": [
        "https://example.com/*"
    ]
}

And here is my popup.html, that is referenced in the error (but without a specific line, only popup.html:0):

<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="stylesheet" href="popup.css">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://example.com">
    <title>Extension Test</title>
</head>
<body>
    <h2>Ghost</h2>
    <form name ="form" id="login_form" action="#">
        <input type="text" id="mdp" placeholder="Password"/>
        <input type ="button" name="submit" value="Login" id="login"/>
    </form>
    
    <button id="logout">Logout</button>
    <script src="popup.js"></script>
</body>
</html>

I know that unsafe-eval is not supported in manifest v3, but I will deal with this error later. If I delete unsafe-eval, the other error remains, so the two are not linked. Thank you in advance!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Finally, the error is solved by adding "files" in the executeScript() function. Before I had:

chrome.scripting.executeScript(
                {
                    target: {tabId: tab.id},
                    function: functionToExecute()
                })

The solution found is:

chrome.scripting.executeScript(
                {
                    target: {tabId: tab.id},
                    files: ['popup.js'],
                    function: functionToExecute()
                })

Thanks again for the help!

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda