Recent updates to error handling and optional remote error logging

As part of our commitment to improving WooCommerce stability and user experience, weโ€™re excited to share updates to our error handling and introduce a new optional remote error logging system as part of the upcoming WooCommerce 9.4 release. These updates are designed to make WooCommerce more robust and simplify troubleshooting for developers and store owners.

Who is this for?

These improvements only affect stores that have tracking turned on.

To learn more about the data we track and our privacy practices, visit WooCommerce Usage Tracking. Stores can opt in or out of sharing data with us for analytics purposes, by going toย WooCommerce > Settings > Advanced > WooCommerce.comย and selecting or deselecting the checkbox to Enable Usage Tracking.

Coming soon in WooCommerce 9.4: Optional Remote Error Logging

In WooCommerce 9.4, we will be introducing an optional remote error logging system to further enhance stability and support, which is only available if users who have opted into usage tracking.

  • Remote Error Logging Epic #49276
  • Implement server-side remote error logging #49599
  • Add JS remote logging package #49702

Benefits

This remote logging feature will provide several benefits:

  1. Faster Fixes: Detailed error data helps us resolve issues more swiftly.
  2. Improved Stability: Early detection of errors leads to a more stable WooCommerce experience.
  3. Better Insights: Aggregated error data informs our development priorities, ensuring we focus on areas that matter most to users.

Data Privacy and Security

We take user privacy seriously and have implemented several measures to protect it:

  1. Opt-in Only: Remote logging is only enabled for users whoโ€™ve explicitly opted into usage tracking.
  2. Data Sanitization: File paths in error traces and URL strings are sanitized to remove any sensitive information.
  3. Limited Data Collection: We only collect error diagnosis and resolution information. Query parameters in URLย will also be replaced with placeholders to avoid collecting sensitive information.

To learn more about the data we track and our privacy practices, visit WooCommerce Usage Tracking.

The remote logging system captures different sets of information based on whether an error occurs server-side (PHP) or client-side (JavaScript).

What information are we logging?

Common Fields

All logs include:

  • host: The site’s hostname
  • request_uri: The URL of the request
  • message: The error message
  • trace: The error stack trace
  • wc_version: WooCommerce version
  • wp_version: WordPress version
  • tags: Identifiers for the type of error (e.g., PHP, JS)

PHP-Specific Fields

Server-side logs additionally include:

  • php_version: The PHP version running on the server
  • store_id: A unique identifier for the WooCommerce store

JavaScript-Specific Fields

Client-side logs additionally include:

  • browser_version: The user’s browser version
  • browser_name: The name of the user’s browser

Can I disable this feature?

The remote logging feature is disabled by default when you install WooCommerce. It is only enabled if you opt into usage tracking.

If you’ve opted in to usage tracking and want to disable remote error logging, you can do so by setting the woocommerce_feature_remote_logging_enabled option to no. For example, you can run wp option update woocommerce_feature_remote_logging_enabled no via WP CLI to disable this feature. This will not impact any other tracking features.

Improved Error Handling in WC Admin

With WooCommerce 9.1, we delivered error handling enhancements in WC Admin pages, making them more stable and resilient.

We added a global error boundary at the top of the WC Admin component tree. This catches unhandled errors, preventing the entire WC Admin app from crashing.

  • Add global ErrorBoundary component for handling errors in react admin #48250
  • Wrap activity panels in error boundary #48415

Benefits

  • Prevents full app crashes due to unhandled errors
  • Displays a user-friendly error message
  • Offers users the option to reload the page or seek help from the community

Fatal error without error boundaries

Fatal error occurs with error boundaries

We’ve also introduced an experimental generic error boundary component in the @woocommerce/components package. This component isolates errors to specific parts of the UI, allowing other components to continue functioning normally.

Isolate errors to the specific component

Feedback and Contributions

We value your feedback and contributions. If you have questions, or suggestions, or want to contribute, drop a comment below or join the GitHub discussion on remote error logging. Weโ€™d love to hear from you!

Stay tuned for more updates as we continue to enhance WooCommerce for developers and users alike!


Keep yourself in the loop!

Sign up for the WooCommerce developer newsletter:
Hidden
Hidden
Hidden


Leave a Reply

Your email address will not be published. Required fields are marked *