-
Notifications
You must be signed in to change notification settings - Fork 328
Description
Bug Description
The message ID for the Site not found error is request_to_auth_proxy_failed, yet it should be site not found as per our support redirects sheet (this could also be changed to site-not-found if more appropriate).
Ideally, this would be updated as soon as possible as users do encounter this error weekly, and the documentation they're directed to isn't appropriate. Once corrected, they're be directed to the new guide added (/documentation/troubleshooting/setup/#site-not-found)
I have a site where this error exists, happy to test any updates.
Additional Context
- PHP Version:
- OS: [e.g. iOS]
- Browser: [e.g. chrome, safari]
- Plugin Version: [e.g. 22]
- Device: [e.g. iPhone6]
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The
Get Helplink on the proxy authentication error is updated to have actual error code added to the link as theerror_idquery parameter if code is provided with the error message.
Implementation Brief
- In
includes/Core/Authentication/Setup.php:- Update the
get_oauth_proxy_failed_help_linkmethod to have$errorargument. - Use actual error code if error has it and it is not the default one
request_failedsite-kit-wp/includes/Core/Authentication/Setup.php
Lines 124 to 131 in 95fe694
private function get_oauth_proxy_failed_help_link() { return sprintf( /* translators: 1: Support link URL. 2: Get help string. */ __( '<a href="%1$s" target="_blank">%2$s</a>', 'google-site-kit' ), esc_url( add_query_arg( 'error_id', 'request_to_auth_proxy_failed', $this->proxy_support_link_url ) ), esc_html__( 'Get help', 'google-site-kit' ) ); } - Update the
get_oauth_proxy_failed_help_linkmethod to pass the error object to theget_oauth_proxy_failed_help_linkcall
- Update the
- In
includes/Core/Authentication/Google_Proxy.php:- Update the
requestmethod to use error code for failed requests if it is provided inerror_codeproperty similarly how we get error message:site-kit-wp/includes/Core/Authentication/Google_Proxy.php
Lines 303 to 304 in 95fe694
$message = is_array( $body ) && ! empty( $body['error'] ) ? $body['error'] : ''; return new WP_Error( 'request_failed', $message, array( 'status' => $code ) ); - If there is no error code provided, then fallback to the code that we currently use.
- Update the
Test Coverage
- Update failing tests and create a new ones to cover new functionality.
QA Brief
QA:Eng
Note that this can't be tested E2E until this service task is complete. Even when it is complete, it will be difficult to fully test without using an intercepting proxy as follows, so we should not wait for the task to be complete before testing this issue.
- Set up an intercepting proxy, e.g. Proxyman, to intercept requests to
https://sitekit.withgoogle.com/o/oauth2/site/. - Click on Sign in with Google on the splash screen.
- Change the response's status code to an error, e.g.
400, and the body to a JSON object witherroranderror_codeproperties, e.g.:
{
"error": "Test error message",
"error_code": "test_error_code"
}- Verify that the error page Site Kit displays includes the value of the
errorproperty in the error message, and links tohttps://sitekit.withgoogle.com/support?error_id={error_code}.
Changelog entry
- Improve the help link destination in the authentication error screen.