GoogleChrome / GoogleChrome/lighthouse

Serverless (function-as-a-service) & lighthouse (NO_SCREENSHOTS, Load timeout)

Open
#14,955 15 comments 1 reaction 1 assignee Assigned to @connorjclark View on GitHub
needs-investigation P3
Dominant language
JavaScript
Stars
30.8k
Forks
9.8k
Avg merge
1d 20h
Merged PRs (30d)
19

Description

Hello 👋
First of all thank you for maintaining this awesome open source tool!

I'm writing this issue to gather the problems that I've stumbled upon so far with using lighthouse on an AWS Lambda.

The setup I'm using is:
- `@sparticuz/chromium` with the following chrome flags https://github.com/Sparticuz/chromium/blob/master/source/index.ts#L144 + additionally `--disable-gpu` (as an AWS Lambda Layer)
- `chrome-launcher` (tried also `puppeteer` instead)
- Lambda Memory - 1536MB

Problems I've faced with running lighthouse on AWS Lambda:

~~1. Load timeout
This happens each time, for every test. It looks like one (or more) of the following conditions seem to never pass on a serverless environment and the timeout (45s by default) is always reached. https://github.com/GoogleChrome/lighthouse/blob/main/core/gather/driver/wait-for-condition.js#L405
I haven't investigated yet which one exactly is causing the issue, but maybe you have done it already? If not then I could maybe find some time next week to investigate this.~~
Read: https://github.com/GoogleChrome/lighthouse/issues/14955#issuecomment-1503085397

2. NO_SCREENSHOTS
This problem happens very rarely and it causes the performance score (with the speed index) to not calculate. It's very hard to pinpoint the exact reason of this as it seems very random. It might be related to the opened chrome instance as I've noticed that on one instance all tests would not contain this error, but on a different one all tests would contain this error. However I cannot confirm this theory. If you could point me to the code that actually performs the screenshots and what could potentially fail in that process then maybe I could investigate that also.

I am fully aware of `Avoid function-as-a-service infrastructure (Lambda, GCF, etc)` inside https://github.com/GoogleChrome/lighthouse/blob/main/docs/variability.md#run-on-adequate-hardware , but I would like to know the reason behind this and whether it would be possible to actually support serverless as it's used very often. I'm guessing that someone already did some investigation around this so I would want to avoid duplicating the work and listen to the reasoning behind not supporting serverless infrastructure and if there are any possible fixes for the above issues I have listed. If you lack time to investigate particular parts, but think something should be possible then let us (the community) know so maybe somebody can help out.

I've also noticed the following issues, but none of them have provided a perfect solution to the above problems:
- https://github.com/GoogleChrome/lighthouse/issues/11537
- https://github.com/GoogleChrome/lighthouse/issues/9027
- https://github.com/GoogleChrome/lighthouse/issues/9107

Appreciate any replies and help 💪

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.