Node.js client SDK returning stale data from release


I've been using Prismic as a content management API to query for content in our backend.
Recently I wanted to programmatically access the content of a release, to test the changes.

The problem is that when creating the release, the first fetch of the documents is the changed documents. But any subsequent changes are not returned from the client SDK. Even when the data is archived and deleted, still returns.

For example, this is the return for one of the documents.

  id: 'Y0PQmBAAACgAhixa',
  uid: 'c1',
  url: null,
  type: 'course_v1',
  href: '',
  tags: [],
  first_publication_date: '2022-10-10T08:33:29+0000',
  last_publication_date: '2022-12-14T08:05:47+0000',
  slugs: [ 'course-1' ],
  linked_documents: [],
  lang: 'de-de',
  alternate_languages: [],
  data: {
    name: 'Course 1',
    cover: [Object],
    providerlogo: [Object],
    providers: 'PowerUs X Installion',
    hourstocomplete: 5,
    material: [Object],
    modules: [Array],
    certificate: [Object],
    category: 'electronic',
    workarea: 'electronic-switch-cabinet-construction'

Notice name: 'Course 1',.

But if I use the browser API using the release ref

The name is updated, to Course 1 - Staging.

The packages used are

    "@prismicio/client": "^6.7.1",
    "@prismicio/helpers": "^2.3.5",
    "node-fetch": "^2.0.0",

The client is configured as

    this.client = prismic.createClient(this.options.repositoryName, {
      accessToken: this.options.accessToken,
      ref: this.options.releaseRef

And the client is called as

    this.client.getAllByType(type, {
      graphQuery: query,
      ref: this.options.releaseRef,
      integrationFieldsRef: this.options.releaseRef

As you can see, I'm also adding the ref to each call as mentioned here apiOption.ref does not seem to work in nuxt.config.js - #13 by jeremy.benzakein, but the data is still stale.

Do you know what could be happening?

Hello Oriol,

Welcome to the Prismic community, and thanks for reaching out to us.

Are you searching the document with the new release ref in the API browser? Whenever you make any changes release ref changes. You can get it by refreshing the API browser.


Thanks for the fast reply. Indeed the reference changes. I checked that before but or I didn't reload the browser API (and therefore the release was not updated) or they are very similar and I thought they were the same.

I call the client.getReleaseByID(id) method to get the reference before each query and it works as expected.

1 Like