-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Build: Fix redirect and error handling in performance results logging #10768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
This actually doesn't solve the issue as it is, follow redirect doesn't work as intended for "post" request (the body is dropped). Let me try to figure out an alternative (maybe use the non redirected url directly) |
Replace `https.request()` with native `fetch()` in `log-results.js` to properly handle HTTP redirects and non-2xx responses. Also removes `www.` from the CodeVitals host to avoid unnecessary redirects. Previously, the script would silently succeed even when the API returned a redirect (301/302) or error response, causing performance results to be lost without any indication in CI. Props youknowriad. Fixes #XXXXX. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
85ef011 to
3a4c7cf
Compare
| BASE_SHA: ${{ steps.base-sha.outputs.result }} | ||
| CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }} | ||
| HOST_NAME: www.codevitals.run | ||
| HOST_NAME: codevitals.run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes avoid the redirects
|
Ok I think this works now, only way to actually test though is to commit. |
mcsf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's test.
Summary
https.request()with nativefetch()inlog-results.jsProblem
The performance results logging script would silently succeed even when the API returned a redirect or error response, causing performance results to be lost without any indication in CI.
Solution
Use native
fetch()(Node 18+) which automatically follows redirects and checkresponse.okto properly fail on error responses.Trac ticket: https://core.trac.wordpress.org/ticket/64534
🤖 Generated with Claude Code