Closed dingyi closed 4 years ago
@dingyi this is very strange! You say that in the GraphiQL you can see data, but can you query data also in your code? Is that only a wrong warning or are you having some issues?
I was getting the same problem when running gatsby build
. In my case, the problem was with the environment variables values:
gatsby-config.js
require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`
});
module.exports = {
plugins: [{
resolve: `gatsby-source-datocms`,
options: {
apiToken: process.env.DATOCMS_READONLY_TOKEN,
// Preview the latest version of records instead of the published one
previewMode: false,
// Disable automatic reloading of content when some change occurs on DatoCMS:
disableLiveReload: false,
apiUrl: 'https://site-api.datocms.com'
}
}]
}
I'm using the NODE_ENV
value to load the correct variables, and during the build NODE_ENV
is production
. Once I created the correct files, everything went well.
normally @dingyi @LluisArevalo this happens when you haven't specified the DATO_API_TOKEN
either in your .env file or directly in the gatsby-config.js file. Can you please give me more details on how to reproduce the problem?
If you want to share your repo with me, either here if it's public or over support@datocms.com if it's private.
thank you for the update @LluisArevalo !
@matjack1 Thank you! I tried DATO_API_TOKEN and it works now!
Excellent, thank you @dingyi for your feedback, I'm closing this for now then :)
When I run gatsby develop, it said:
but I still can query data from DatoCMS in http://localhost:8000/___graphql
How can I fix this error warning?