JS SDK Queue pagination across divisions fails on nextLink

I’m curious as to why the nextLink returned by api.queuesApi.getQueues ignores the divisionId filter when making subsequent requests?

Background: Using Genesys Cloud JS SDK v5. I need to fetch all queues across multiple divisions.

Issue: The initial request works, but the SDK automatically follows the nextLink from the response. This link does not include the divisionId query param, so it returns queues from all divisions, not just the filtered one. I cannot find a way to override the default followRedirects or inject the param into the internal fetch.

Troubleshooting: Tried setting paginationOptions but it seems to only handle page size, not query string persistence. Manually parsing nextLink and re-adding divisionId feels brittle.

the problem here is nextlink drops query params by design. don’t rely on sdk auto-pagination for filtered lists. fetch pages manually using the last entity id from the previous response and append divisionid to each request.

let entityId = null;
do {
 const res = await api.queuesApi.getQueues(null, null, null, null, 100, null, entityId, null, null, divisionId);
 // process res.entities
 entityId = res.entities[res.entities.length - 1]?.id;
} while (entityId);

It varies, but usually the JS SDK’s auto-pagination is unreliable for filtered endpoints, so you should implement manual pagination in your CI/CD scripts to ensure the divisionId is re-applied to every request, as the nextLink often strips query parameters. Use a loop that fetches pages using the pageSize and pageNumber or pageToken explicitly, ensuring the division filter is maintained across all iterations to avoid missing data or hitting rate limits.