Gatsby-source-datocms and draft content for previews

Hi all, as many of you we have also fallen prey to the preview issues when moving from Gatsby Cloud to Netlify.

In order to quickly get something up-and-running we would like to build a branch of our codebase, with a slightly modified gastby-source-datocms plugin config:

    {
      resolve: "gatsby-source-datocms",
      options: {
        apiToken: process.env.DATO_API_TOKEN,
        environment: process.env.DATO_ENVIRONMENT,
        previewMode: true,
        disableLiveReload: false,
      },
    },

We were hoping that this way we would be able to retrieve draft content from DatoCMS, but this does not seem to be the case?

Are we doing something wrong, or does previewMode: true not work like we interpreted it to work?

We based us on the following documentation: gatsby-source-datocms | Gatsby

 // If you are working on development/staging environment, you might want to
 // preview the latest version of records instead of the published one:
 previewMode: false,

Hey @tom.metten I think you are looking for the discussion in this topic right here: Gatsby Cloud Preview plugin alternative after migration to Netlify - #5 by dmv

Hi @m.finamor I have seen this thread as well, but we also are not able to easily switch to Stackbit.

As a short-term solution we would like to use the method described in my initial post, but we are not seeing the draft content being updated after a rebuild with these plugin configuration settings.

hey @tom.metten I’ve just tried and the previewMode: true works fine for me.

Can you please provide more information on which Gatsby version and source plugin version you are using? Also can you try locally on the GraphiQL explorer to see if the data there is correct?