Skip to content

Update Site not found message ID #11529

@jamesozzie

Description

@jamesozzie

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.

Image

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 Help link on the proxy authentication error is updated to have actual error code added to the link as the error_id query parameter if code is provided with the error message.

Implementation Brief

  • In includes/Core/Authentication/Setup.php:
    • Update the get_oauth_proxy_failed_help_link method to have $error argument.
    • Use actual error code if error has it and it is not the default one request_failed
      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_link method to pass the error object to the get_oauth_proxy_failed_help_link call
  • In includes/Core/Authentication/Google_Proxy.php:
    • Update the request method to use error code for failed requests if it is provided in error_code property similarly how we get error message:
      $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.

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 with error and error_code properties, e.g.:
{
  "error": "Test error message",
  "error_code": "test_error_code"
}
  • Verify that the error page Site Kit displays includes the value of the error property in the error message, and links to https://sitekit.withgoogle.com/support?error_id={error_code}.

Changelog entry

  • Improve the help link destination in the authentication error screen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Medium priorityPHPQA: EngRequires specialized QA by an engineerTeam MIssues for Squad 2Type: EnhancementImprovement of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions