-
Notifications
You must be signed in to change notification settings - Fork 216
Add logging for HTTP validation failures #4764
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
Add logging for HTTP validation failures #4764
Conversation
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.
Pull Request Overview
This PR adds enhanced logging for URL validation issues when calling the Stripe API. The changes extract error logging into a dedicated method and add special handling to diagnose DNS resolution problems when WordPress core detects invalid URLs.
- Refactored error logging from inline code into a reusable
log_error_response()method - Added DNS resolution diagnostics when URL validation failures occur
- Comprehensive test coverage for the new logging functionality
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| includes/class-wc-stripe-api.php | Extracted error logging to log_error_response() method and added DNS resolution diagnostics for URL validation errors |
| tests/phpunit/WC_Stripe_API_Test.php | Added comprehensive tests for error logging scenarios including URL validation failures |
| readme.txt | Updated changelog to document the new logging features |
| changelog.txt | Updated changelog to document the new logging features |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
diegocurbelo
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.
Mayisha
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>



Fixes STRIPE-795
Changes proposed in this Pull Request:
This PR refactors some of our error logging in
WC_Stripe_APIinto a singlelog_error_response()function and adds more logging when we encounter a specific situation where the URL we are trying to call fails validation. This specific case was seen while digging into error logs for STRIPE-745, but we need additional logging to be able to get more details when that occurs.Testing instructions
The simplest way to test this is as follows:
/etc/hosts(or its equivalent)/etc/hostsfor your host machine/etc/hostsfile to add a line like the following to redirectapi.stripe.comto your local machine:#.resolved_ip_addressandvalidation_detailskeys.We don't think we're seeing anything as problematic as this in the wild, but we have seen some merchants report issues with HTTP requests to Stripe failing with this type of error, and this logging should help us to debug that should it occur again.
Changelog entry
Changelog Entry Comment
Comment
Post merge