Skip to content

fix(zendesk-api): handle pagination limit error gracefully for getTags#295

Merged
cuneytcelebican merged 5 commits into
mainfrom
cuneyt-celebican/SCLABS-2911-fix-tags-pagination
May 11, 2026
Merged

fix(zendesk-api): handle pagination limit error gracefully for getTags#295
cuneytcelebican merged 5 commits into
mainfrom
cuneyt-celebican/SCLABS-2911-fix-tags-pagination

Conversation

@cuneytcelebican
Copy link
Copy Markdown
Contributor

@cuneytcelebican cuneytcelebican commented May 8, 2026

Summary

Fixes SCLABS-2911 - Tags fail to load for customers with 10k+ tags

Problem

When customers have 10,000+ tags (e.g., bukabantuan.zendesk.com), the getTags() method crashes when hitting Zendesk's pagination limit. The API returns a 400 error at page 101:

Error: InvalidPaginationDepth Status: 400
Message: "Pagination requests using Offset Pagination are limited to page 100 or up to 10000 records (page * per_page)"

This blocks tag-based audience segmentation in the Relay app, preventing a core feature from working.

Solution

Added error handling in fetchAllPaginatedResults() to:

  • Catch InvalidPaginationDepth errors from Zendesk API
  • Stop fetching gracefully at pagination limit (page 100 / 10,000 records)
  • Return partial results (first ~10,000 tags) with console warning
  • Include endpoint URL in warning message for debugging
  • Re-throw all other errors normally

Changes

Testing

✅ All 151 tests pass
✅ New test: pagination limit error handling
✅ New test: non-pagination errors still thrown
✅ No regressions in existing functionality
✅ 98.69% code coverage maintained

Impact

  • ✅ Customers with 10,000+ tags can now use tag-based audience segmentation
  • ✅ App loads first ~10,000 tags successfully instead of crashing
  • ✅ Clear error message helps with debugging
  • ✅ Graceful degradation instead of complete failure

Acceptance Criteria

  • Add error handling to fetchAllPaginatedResults() to catch 400 pagination errors
  • Stop fetching gracefully at page 100 instead of crashing
  • Load and display the first ~10,000 tags successfully
  • Show warning message when limit is reached
  • Verify no regression for accounts with < 10K tags

Notes

The next phase (free-text tag entry in the UI) is tracked separately as it requires changes in the consuming application, not this library.

🤖 Generated with Claude Code

Fixes SCLABS-2911

**Problem:**
When customers have 10,000+ tags, the getTags() method crashes when hitting
Zendesk's pagination limit (page 100 / 10,000 records max). This blocks
tag-based audience segmentation in Relay app.

**Solution:**
- Add error handling in fetchAllPaginatedResults() to catch InvalidPaginationDepth errors
- Stop fetching gracefully at pagination limit instead of crashing
- Return partial results (first ~10,000 tags) with console warning
- Include endpoint URL in warning message for debugging

**Testing:**
- Added test for graceful pagination limit handling
- Added test to verify non-pagination errors are still thrown
- All existing tests pass

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry...:sweat: The following steps failed:

- Add eslint-disable-next-line for console.warn statement
- Fix prettier formatting in test expectations

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
github-actions[bot]
github-actions Bot previously approved these changes May 11, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🤖 🚀 🔥

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@github-actions github-actions Bot dismissed their stale review May 11, 2026 14:05

Dismiss bot.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🤖 🚀 🔥

@cuneytcelebican cuneytcelebican added this pull request to the merge queue May 11, 2026
Merged via the queue into main with commit 2226e8e May 11, 2026
10 checks passed
@cuneytcelebican cuneytcelebican deleted the cuneyt-celebican/SCLABS-2911-fix-tags-pagination branch May 11, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants