gatsby-source-datocms: previewMode not working correctly on gatsby cloud with gatsby v3 version
In gatsby cloud, for our website project, we have set the value of previewMode to true, but the plugin gatsby-source-datocms uses only the published content from datocms. Ideally, it should use the non-published content as well. Refer to the below code for plugin configuration in our website project.
{ resolve:gatsby-source-datocms, options: { apiToken: process.env.DATO_API_TOKEN, environment: process.env.DATO_ENVIRONMENT || main, previewMode: (process.env.DATO_PREVIEW_MODE || 'FALSE').toLocaleUpperCase() === "TRUE" }, },
In gatsby cloud environment variable we have the variable DATO_PREVIEW_MODE with value ‘true’
Note that we are using the gatsby-source-datocms version 2.6.6. Then I tried upgrading to the latest version 2.6.15 and tested. But the issue still exists.
Surprisingly previewMode is working correctly when we make the build from the local machine.
Another point to note is that previewMode working correctly on gatsby cloud with the website project using the gatsby v2 version.
we came across this issue while migrating our website gatsby project from gatsby v2 to gatsby v3 version. So this issue is holding us on the release of our new version of the website. Please help us to resolve this issue.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (7 by maintainers)
Thanks @graysonhicks. Maybe you can coordinate with @Sarankrishna to understand why the
GATSBY_IS_PREVIEWenvironment variable is set to “false” for their Gatsby Cloud project then?Thanks!
@stefanoverna 2.6.16 worked. Now it is using the previewMode value set in gatsby-config.js file. Thanks a lot for the fix.