Skip to content

Avoid duplicate PageSpeed API error logs - #256

Merged
michaelbonner merged 1 commit into
masterfrom
fix/pagespeed-duplicate-api-errors
Oct 31, 2026
Merged

michaelbonner merged 1 commit into
masterfrom
fix/pagespeed-duplicate-api-errors

Conversation

@michaelbonner

Copy link
Copy Markdown
Collaborator

Summary

 if (!res.ok) {
   const body = await res.text();
-  console.error("res data", body);
   // Parse PageSpeed's reason and throw it to the caller.
 }

Keep the per-page preload failure line, which includes strategy, URL, and the parsed PageSpeed reason. Remove the raw multi-line API response that Grafana counted as several errors for one request.

Evidence

  • Before: The October 31 PageSpeed log includes repeated "error" and "message" lines from one Google API response, plus preload failed lines for the same request.
  • After: The raw response logger is removed; bun run lint and bunx tsc --noEmit pass. API failures still throw the parsed reason to the caller.

Merge Danger

Door: Two-way. Revert the single line to restore raw response logging.

Blast Radius: PageSpeed diagnostics only. Request and retry behavior are unchanged.

A failed Google PageSpeed response was printed as multi-line JSON and then logged again by the preload caller. Grafana counted several lines from one failed request as separate app errors. Keep the parsed error reason and the caller log, and drop the raw response dump.
@michaelbonner
michaelbonner merged commit 0c94c87 into master Oct 31, 2026
5 checks passed
@michaelbonner
michaelbonner deleted the fix/pagespeed-duplicate-api-errors branch October 31, 2026 21:18
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

🧹 Preview environment for this PR has been torn down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant