Iâve been using gatsby-source-datocms on my gatsby application to load data from two different projects. However, if I start a brand new app and try to connect to the same projects, it doesnât work. It only loads the data from the first project on the gatsby-config file (see sample below).
{
resolve: gatsby-source-datocms
,
options: {
apiToken: process.env.DATO_API_TOKEN,
previewMode: true,
disableLiveReload: false,
},
},
{
resolve: gatsby-source-datocms
,
options: {
apiToken: process.env.DATO_API_TOKEN_MASTER,
previewMode: true,
disableLiveReload: false,
},
},
EDIT:
It seems it works if I add a spacific version of the plugin âgatsby-source-datocmsâ: â2.1.29â, but it breaks if I use the caret in front of the version âgatsby-source-datocmsâ: â^2.1.29â. Also it seems it doesnât work at all with any of the 2.2.x versions of the plugin.
@jgiraldo can you please check which version of the datocms-client you have installed in your package.lock/yarn.lock file?
I fixed that in 3.0.17 of that package, which is a dependency of our Gatsby source. If that is the case, can you maybe share access to your repo so that I can better replicate your issue? (feel free to send details over DM)
I have datocms-client â>=3.0.16â
check in the lock file to see whatâs the version that you are actually using, if you have that in the package.json might mean that you have an old version.
If instead you have 3.0.17 can you please send over a link for your repo (via DM). Thanks!
@mat_jack1 I am getting the same issue now when I update to âgatsby-source-datocmsâ: â^2.5.17â which is using âdatocms-client@>=3.3.0â according the lock file.
ok @jgiraldo weâll have a look and get back to you, sorry for this
Thank you @mat_jack1. I wanted to use the new Structured Text functionality and wasnât working with the version of gatsby-source-datocms I had when I tried to update to the latest, everything broke.
@mat_jack1 any updates on this?
not yet sorry, but weâll have a look soon at this, we havenât forgot
1 Like
@s.verna Thank you for looking into this. I installed the 2.6.5-0 version on a new project and I can see both projects listed; however the instancePrefix only works on one of them; it wonât show the two different prefixes, just one. Not a big deal but I just wanted to let you know.
I also Installed v2.6.5-0 on a current project that was using v2.1.29 and then I get all kinds of errors. for example:
"gatsby-source-datocms" threw an error while running the createSchemaCustomization lifecycle:
TypeError: getGatsbyImageResolver is not a function
Missing onError handler for invocation 'building-schema', error was 'Invariant Violation: Encountered an error trying to infer a GraphQL type
for: `fields___NODE`.
...
So, since I get these errors on a current project, the site wonât build.
EDIT: I got it to work. The problem was that I didnât have the gatsby-plugin-image
plugin installed. Once I installed it, I didnât get any errors
Thank you,
1 Like
Mh, do you have the gatsby-plugin-image package installed?
@s.verna That was the issue. Once I installed it, it worked just fine.
1 Like