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

345
Vistas
Node.js Lighthouse custom Gatherer/Audit - Protocol error (Runtime.evaluate): Object reference chain is too long

I am trying to implement custom audits using the lighthouse library lighthouse and executing some Javascript commands within the Gatherer I get the following error:

Protocol error (Runtime.evaluate): Object reference chain is too long

In detail I have the following Gatherer:

'use strict';
const { Gatherer } = require('lighthouse');

class customGatherer extends Gatherer {
 afterPass(options, loadData) {
    const expression = `window.document.getElementsByTagName('*')`;

    const driver = options.driver;

    return driver.evaluateAsync(expression);
 }
}

module.exports = customGatherer;

That with the expression defined above triggers the problem. There seems to be too much information and I can't manage it. I'm testing the command on a web page and it returns 1059 collections (HTMLCollection(1059)).

When I run the lighthouse command to inspect a page, the warning is created and the result cannot be manipulated within the audit:

LH:Runner:warn customGatherer, required by audit my-custom-audit, encountered an error: Protocol error (Runtime.evaluate): Object reference chain is too long +0ms

NB: In the lighthouse log i can see also this error:

 LH:method <= browser ERR:error Runtime.evaluate  +24ms

I need to have a Gatherer that returns all HTMLCollection elements in order to compute them to get all the fonts on the page. How can I get around this problem?

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

0

There is already an artifact that collects all font information on a page: https://github.com/GoogleChrome/lighthouse/blob/master/types/artifacts.d.ts#L139

As for the actual error, you'd need to write a more complex function that you'd pass to evaluate to process the DOM and return only the data you want. If you write anything more than a single-line expression I suggest using driver.evaluate instead (see the Lighthouse repo for examples).

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