Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

338
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!