Confused by getAll response (999 vs. 1000)

Hi everyone, really appreciate the support.

I have a site that has built perfectly for some time and now, without changes, we’re seeing that the latest content updates made in Contentful are not being pulled to the Content Delivery API.

We have a getAll loop configured (below) which has worked to date, but when we limit the query to 1000, we’re seeing that it misses the newest entry.

If I change the limit to 999, it appears to pull in everything.
response.items.length for “post” count is 413 with the query limit set to 999 and 412 when the query limit is set to 1000.

I’m fine to change this to 999 but does anyone have any clue as to why this is happening?

Thank you!

module.exports = getAll('post', 999, '', {
  'fields.slug[exists]': true,
  'fields.category[exists]': true,


async function getAll(type, limit, order, otherParams) {
  // how to order the records
  const queryOrder = order ? order : 'sys.createdAt';

  // max number of records to fetch per query
  const recordsPerQuery = limit ? limit : 1000;

  // number of records to skip (start at 0)
  let recordsToSkip = 0;

  const parameters = {
    limit: recordsPerQuery,
    skip: recordsToSkip,
    content_type: type,
    include: 10,
    order: queryOrder,

  // do we make a query ?
  let makeNewQuery = true;

  // entries array
  let entries = [];

  while (makeNewQuery) {
    await contentfulClient
      .then((response) => {
        // update entries array with the data from the response
        entries = entries.concat(response.items);

        // prepare for next query
        recordsToSkip += recordsPerQuery;

        // check if we are geting back less than the records we fetch per query

        console.log(type+' count: '+response.items.length);

        // if yes, stop querying
        if (response.items.length < recordsPerQuery || recordsPerQuery < 1000) {
          console.log('No new query needed for '+type);
          makeNewQuery = false;

  return entries;