Pagination widget RangeError when using JWT

Again, based on the codepen here, I have a nice result - all my hits and facets are there - but the pagination widget is broken and I get this RangeError.

This only happens when using a JWT instead of my regular Search-Only API Key.

The JWT is long but not excessive: 725 chars. It encapsulates nine facet filters, and the API key that it is based upon restricts usage by ACL (search), HTTP REFERER, and Index.

Here’s the full error:

Uncaught (in promise) RangeError: Invalid array length
    at Ie (range.ts:18)
    at t.value (Paginator.js:31)
    at Object.render (connectPagination.js:147)
    at index.ts:481
    at Array.forEach (<anonymous>)
    at Object.render (index.ts:472)
    at InstantSearch.ts:510
    at defer.ts:26

This was solved with the help of Algolia Support:

The Secure API key that I generated did not include the necessary response fields for pagination to work.

So while I thought

'responseFields': ['hits', 'facets']

was enough, I actually needed

'responseFields': ['hits', 'facets','page', 'nbHits', 'nbPages', 'hitsPerPage', 'exhaustiveNbHits']