Closed zjr closed 2 years ago
Thanks for the info! I'm unsure if this is a Craft or Navigation (or Gatsby Source) issue.
This also might be related to another bug, which is fixed for the next release. To get the fix early, change your verbb/navigation
requirement in composer.json
to:
"require": {
"verbb/navigation": "dev-craft-4 as 2.0.6",
"...": "..."
}
Then run composer update
.
I can't be quite sure if that fixed it or not. I updated the requirement and still had the problem, but then manually corrected the elementId
's in my structureelements
table, and, since then, I haven't had the problem recur. So, seems good?
Hmm, I'll close for now, but will keep an eye on it.
Describe the bug
Hello again! Sorry to bug you but I seem to have encountered another issue in the Navigation / Gatsby Plugin /
gatsby-source-craft
triangle.This problem occurs during Gatsby's
sourceNodes
lifecycle after updating a something in Navigation. I do have a bit of background for this one.Here's the error that occurs on the Gatsby end:
NOTE: I found that this error occurs because
updatedNodes
isnull
, so, trying tomap
it will cause aTypeError
. it's null because the query it's trying to get data from actually returns an error, but, for some reason,gatsby-source-craft
decides not to check for or throw any errors from the GraphQL query it executes here.Here is the actual result of the query it's running:
Here is the error logged in Craft:
And here's the error logged by the database (much easier to read):
Problem is in the
OR ("e"."id" IN ($4, $5)))
bit at the end there, which I tracked down to\craft\gatsbyhelper\services\Deltas::getUpdatedNodesSinceTimeStamp
, specifically this bitvendor/craftcms/gatsby-helper/src/services/Deltas.php:98
:I checked my database and my
structureelements
table has a row with aNULL
elementId
, hence the SQL error. I don't really know anything about this table but it looks like it's a tree and that NULL element appears to be a sibling to another Navigation Node and appears to be a child of what I'm pretty sure is the backing structure to my main navigation. Ah, I did just match them by looking at the created date… I don't see this element's ID in thestructureelements
table. I also have 5 other NULL elementId rows here, don't know if that's relevant.Steps to reproduce
gatsby-source-craft
.gatsby develop
and trigger a data refresh.Note: during development, this is a non-totally-breaking issue, in that it won't cause the build to abort, but it does require me to delete my caches before I can get new data. During production builds this will cause the build to abort.
Craft CMS version
4.2.5.1
Plugin version
2.0.6
Multi-site?
No
Additional context
"gatsby-source-craft": "^3.0.0"
This is a new site, started on Craft 4. It's only existed for a few weeks so hasn't seen any major updates. I did update Navgation from 2.0.5 -> 2.0.6.