I'm problems with loading more than a 100 entries.
I dispatching an action in nuxtInitServer, that calls a async method with a do while loop that increments the page number and return the data
const getPages = async (context) => {
const data = []
let pageNum = 1
let lastResult = []
do {
const resp = await context.$prismic.api.query(
context.$prismic.predicates.at('document.type', 'artists'),
{
pageSize: 100,
page: pageNum
}
)
lastResult = resp
data.push(resp.results)
pageNum++
} while (lastResult.next_page !== null)
return data
}
But when I run "npm run generate" I get this error for some of my subpages.
FetchError: request to https://rtt2020.cdn.prismic.io/api/v2/documents/search?&page=1&pageSize=1&ref=X7KK4xIAACAAeYOk&q=%5B%5Bat(document.type%2C%20%22globals%22)%5D%5D failed, reason: read ECONNRESET
at ClientRequest.<anonymous> (/Users/kristianjohansen/Sites/rtt2020.nuxt/node_modules/cross-fetch/node_modules/node-fetch/lib/index.js:1461:11)
at ClientRequest.emit (events.js:314:20)
at ClientRequest.EventEmitter.emit (domain.js:486:12)
at TLSSocket.socketErrorListener (_http_client.js:469:9)
at TLSSocket.emit (events.js:314:20)
at TLSSocket.EventEmitter.emit (domain.js:486:12)
at emitErrorNT (internal/streams/destroy.js:100:8)
at emitErrorCloseNT (internal/streams/destroy.js:68:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
If I only load the first 100 it works. So guess there is something wrong with the function. Anyone knows how to load more than a 100 results?
Many thanks!