site-kit-wp: Update ReportError to use module specific ids of the insufficient permissions error when we build the get help link

Feature Description

The insufficient permissions error has no error code, so when we build a get help link only error message is used. We need to generate a fake error code for the insufficient permissions error in the ReportError component to allow the support team to redirect users to module-specific articles.

https://github.com/google/site-kit-wp/blob/0d5b670504745849367c6274776ba9adcc824358/assets/js/components/ReportError.js#L77-L81

So, instead of passing an error to the getErrorTroubleshootingLinkURL selector directly, we need to check if this error is the insufficient permissions error and add ${ moduleSlug }_insufficient_permissions error code.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The Get Help link in the ReportError component for the insufficient permissions error should have module specific error code: ${ moduleSlug }_insufficient_permissions.

Implementation Brief

In assets/js/components/ReportError.js, add the following changes:

  • Map the errors array and check if the error object has an insufficient permissions error using the isInsufficientPermissionsError helper.
  • If it is, return the existing error object and add the module slug to the error code - code: ${ moduleSlug }_insufficient_permissions.
  • If it is not, then return the existing error object.

Test Coverage

In assets/js/components/ReportError.test.js, add test coverage to check the getErrorTroubleshootingLinkURL selector returns the correct URL for the insufficient permissions error with the error code for the Get help link.

QA Brief

  • Trigger the Insufficient permissions error on any module (for e.g Analytics). For e.g setup Analytics as another user and don’t grant permissions to a user.
  • Check the “Get help” URL contains the following string: error_id=analytics_insufficient_permissions where analytics is the module slug.

Changelog entry

  • Update the ReportError component to add the module slug to the insufficient error codes.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 16 (3 by maintainers)

Most upvoted comments

@felixarntz please see my comments on your PR, but TL;DR this shouldn’t be necessary 👍

Another question unrelated to the code here, has the service / the CSV already been updated to account for the new error codes? Or do we need to create a task to create matching documentation?

James has already added new redirects for module specific errors to the redirects mapping document. I have created a new ticket in Asana and asked Adam to help with uploading it to production.

@felixarntz @jamesozzie the CSV with the latest error redirects mapping has been uploaded to production and new redirects work now: https://sitekit.withgoogle.com/support/?error_id=search-console_insufficient_permissions

searchconsole_insufficient_permissions - which will direct to this guide

@jamesozzie this one should be search-console_insufficient_permissions, other look good.