Open pleodigital opened 1 year ago
The LIST_
prefix is a Gastby convention. In the initial sourcing, it creates it's own queries (aided by our source plugin) in order to get all the content from Craft.
Are there any additional logs that might point toward the problem? Could you clear the gatsby cache and give it another try if you haven't already?
My logs: web-2023-03-20.log . I'm clearing gatsby cache before every 'develop' or 'build' command.
Looks like you have a call to getSourceUid()
somewhere (potentially by having sourceUid
within your graphql query). That method was deprecated in 4.0 and has been replaced by getCanonicalUid()
. If you have any sourceUid
properties in your query, can you replace them with canonicalUid
and see if that solves it?
You'll probably want to do a pass through the upgrade guide and make sure you don't have any other deprecated methods hanging around.
I don't have any getSourceUid() or sourceUid in my code. At this moment I have blank Gatsby v4 project with no graphql queries at all, I just want to run gatsby develop without error to run graphiQL. I don't think gatsby setup can be wrong, because it works with my project with craft cms v3 (version before updating to v4).
The main error in the logs is
2023-03-20 08:54:40 [web.ERROR] [craft\errors\DeprecationException] craft\errors\DeprecationException: Elements’ `getSourceId()` method has been deprecated. Use `getCanonicalId()` instead. in C:\xampp\htdocs\craft-polska-misja-medyczna\vendor\craftcms\cms\src\gql\base\ObjectType.php:72
Stack trace:
Did you update the Gatsby helper plugin along with Craft and the Gatsby source plugin?
Yes, I have Gatsby Helper v2.0.1 installed. I've also tried with 2.0.0 but with no result. Craft version is 4.4.3, gatsby-source-craft v.3.0.0. Everything has the newest possible version, maybe there's some combination of previous versions to make it work?
Unfortunately, I'm not able to replicate this on a fresh install. Could you package up a db dump, the gatsby files, your composer.json
and composer.lock
and send it to support@craftcms.com
?
I sent the files you requested, but accidentally used a private email instead of a company email, so please ignore first email and use files from second one (this from info@pleodigital.com). In first email I sent wrong composer files. Sorry for the trouble.
All good! I got them, I'll take a look and let you know what I find. Thanks!
The solution to the problem turned out to be simple, but not obvious to come up with. I needed to create my GraphQL schema and API token once again. Looks like it was problem with recognition of schema created with Craft 3. Or maybe it's just a coincidence, either way it works :)
Description
I have website build in Gatsby v3 which sources data from Craft CMS v3 in headless mode with graphql api. I updated both Gatsby and Craft to v4 and now I can't source data. On running gatsby develop and gatsby build I'm getting whole list of errors with all data typenames : ERROR #11321 PLUGIN
"gatsby-source-craft" threw an error while running the sourceNodes lifecycle:
Failed to execute query LIST_banner_module_Entry.
Which doesn't make any sense, I don't have any data typename starting with "LIST_".
I assume my config in Craft and it gatsby is ok because it works fine before update. Craft CMS config: general.php file: 'enableGql' => true, 'headlessMode' => true, composer.json: "craftcms/gatsby-helper": "2.0.1", Gatsby config:
gatsby-source-craft
, options: { craftGqlToken: process.env.CRAFTGQL_TOKEN, craftGqlUrl: process.env.CRAFTGQL_URL, enabledSites: [default
], retryOptions: { retries: 15 }, },Steps to reproduce
Additional info
I can't find a way to fetch my data, do you have any ideas? What's interesting, when I'm trying to fetch data to my updated Gatsby v4 page from not updated Craft 3 everything works fine.