Skip to content

Open source alternative to Semrush and Ahrefs

chore: log Lighthouse runtime errors at warn and include strategy (#539)

Ben Senescu11a874ed3b26
diff --git a/src/server/lib/audit/lighthouse.ts b/src/server/lib/audit/lighthouse.ts
index 834e9206..49ae29bf 100644
--- a/src/server/lib/audit/lighthouse.ts
+++ b/src/server/lib/audit/lighthouse.ts
@@ -76,7 +76,15 @@ export async function fetchLighthouseResult(
};
} catch (error) {
const failed = error instanceof Error ? error : new Error(String(error));
- console.error(`Lighthouse failed for ${url}:`, failed.message);
+ // Lighthouse runtime errors (ERRORED_DOCUMENT_REQUEST, NOT_HTML, NO_FCP) mean the
+ // tenant's page didn't load for the provider's Chrome. The failure is already
+ // surfaced on the audit row, so there is nothing for us to act on.
+ const log = failed.message.includes(
+ "Lighthouse encountered an error with the following code",
+ )
+ ? console.warn
+ : console.error;
+ log(`Lighthouse failed for ${url} (${strategy}): ${failed.message}`);
return failedLighthouseFetch(url, pageId, strategy, failed.message);
}
}