Contentful logo

Contentful Community

getEntries returns unresolved entries

#1

Hello

I’m using node contentful module to fetch the entries from contentful and save them into a local file.
The code is pretty straightforward and it works but it fetches also a deleted entry which can’t be resolved. Here’s the code:

const client = contentful.createClient({
   space: <SPACE_ID>
   accessToken: <TOKEN>
   host: <HOST>,
  removeUnresolved: true,
});

client. getEntries({
   content_type: 'fragment',
   'fields.name': <SOME FIELD NAME>,
   locale: '*',
   include: '2',
});

This code works and fetches existing entries correctly but it also gets some entries which has been removed from contentful. Here’s the error section

"errors": [
    {
      "sys": {
        "id": "notResolvable",
        "type": "error"
      },
      "details": {
        "type": "Link",
        "linkType": "Entry",
        "id": <id #1>
      }
    },
    {
      "sys": {
        "id": "notResolvable",
        "type": "error"
      },
      "details": {
        "type": "Link",
        "linkType": "Entry",
        "id":  <id#2>
      }
    }
  ],

I checked contentful dashboard and those entities do not exist, I am wondering why they are still being fetched.
Question: is there a way to avoid fetching deleted entries?

0 Likes

#2

SOLVED from the dashboard, code was wrong

0 Likes