Tuesday, November 12, 2024

Sitecore API Pagination and Sorting Errors

 The Sitecore API was experiencing critical issues impacting pagination and sorting functionalities. Whenever users attempted to navigate to subsequent pages or apply sorting, the API returned internal server errors (500), rendering the features unusable.




Issue Summary

  1. Internal Server Errors (500):
    When pagination or sorting requests were sent, the API intermittently responded with:



    { "widgets": [ { "rfk_id": "test_widget_1", "type": "content_grid", "errors": [ { "message": "Internal Server Error", "code": 1001, "type": "internal_server_error", "severity": "HIGH" } ] } ] }
  2. Sorting Failures:
    Sorting configurations such as title_asc_asc or title_desc_desc failed to produce expected results. Responses either returned incorrect data or triggered the same server error.

  3. Inconsistent Pagination Behavior:
    For example, attempting to navigate to page 2 through /search?page=2 consistently produced the following:


    { "message": "Internal Server Error", "code": 1001, "type": "internal_server_error" }

Root Cause (Identified by Sitecore Team)

The Sitecore support team determined that the issue was caused by:

  1. A combination of boost rules and pagination settings that conflicted under certain API configurations.
  2. Faulty API handling logic when fetching large datasets while applying custom sorting and pagination rules.

Resolution

  1. System Update:
    Sitecore implemented a patch to rectify how boost rules interact with pagination requests.
  2. Configuration Adjustments:
    The team updated internal settings to ensure sorting worked seamlessly with pagination.
  3. Verification:
    After the fix was deployed, multiple test cases were executed to confirm that:
    • Pagination worked correctly.
    • Sorting options applied accurately without triggering server errors.

No comments:

Post a Comment