Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breadcrumb produce Internal server error on ContentType #81

Closed
2 of 3 tasks
MonPetitUd opened this issue Apr 4, 2024 · 5 comments · Fixed by #90
Closed
2 of 3 tasks

breadcrumb produce Internal server error on ContentType #81

MonPetitUd opened this issue Apr 4, 2024 · 5 comments · Fixed by #90
Labels
status: confirmed 📍 The issue has been confirmed and reproduced. type: bug 🐛 Something isn't working

Comments

@MonPetitUd
Copy link

Description

When "ContentType" is returned by a nodeByUri query (for example on the page for posts e.g. "/blog" or woocommerce shop page e.g. "/shop") including "breadcrumbs" under "NodeWithRankMathSeo" produces an internal server error. The data is still returned with the breadcrumbs being null. I suspect breadcrumbs are not actually available on this type?

Steps to reproduce

Example query:

query rankMathNodeByUri {
	nodeByUri(uri: "/blog") {
		__typename
		... on NodeWithRankMathSeo {
			seo {
				__typename
				title
				description
				breadcrumbs {
					text
					isHidden
					url
				}
			}
		}
	}
}

Result:

{
	"errors": [
		{
			"message": "Internal server error",
			"extensions": {
				"category": "internal"
			},
			"locations": [
				{
					"line": 9,
					"column": 5
				}
			],
			"path": [
				"nodeByUri",
				"seo",
				"breadcrumbs"
			]
		}
	],
	"data": {
		"nodeByUri": {
			"__typename": "ContentType",
			"seo": {
				"__typename": "RankMathPostTypeSeo",
				"title": "Blog - Website Name",
				"description": "Blog page SEO description",
				"breadcrumbs": null
			}
		}
	}
}

Additional context

No response

Plugin Version

0.1.1

WordPress Version

6.4.3

WPGraphQL Version

1.22.1

RankMath SEO Version

1.0.216

Additional enviornmental details

WooGraph 0.19.0
WooCommerce 8.6.1

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for RankMath SEO, WPGraphQL, and WPGraphQL for Rank Math

  • Yes
  • My issue is with a specific 3rd-party plugin.
@justlevine
Copy link
Member

Thanks for taking the time to report this @MonPetitUd !

Would you be able to:

  1. Confirm what PHP version you're running, and
  2. Enable GraphQL Debugging (either via GraphQL Settings or with the GRAPHQL_DEBUG constant), rerun the query, and share the debugMessage that (hopefully) gets generated?

I'm working on a fix now, but that information will help me confirm I'm on the right path 🤞

@justlevine justlevine added status: confirmed 📍 The issue has been confirmed and reproduced. type: bug 🐛 Something isn't working labels Apr 6, 2024
@justlevine
Copy link
Member

(Additional context - the fatal error itself seems to be a PHP error and solvable by setting a default value to SeoModel:$databaseId. The larger underlying issue that ContentType objects don't have a global archive context, due to the lack of an archive interface, so even with the fatal fixed the data itself is bad).

@MonPetitUd
Copy link
Author

No worries @justlevine.

PHP 7.4

Below is the response with GraphQL debugging on:

{
	"errors": [
		{
			"debugMessage": "Typed property WPGraphQL\\RankMath\\Model\\Seo::$database_id must not be accessed before initialization",
			"message": "Internal server error",
			"extensions": {
				"category": "internal"
			},
			"locations": [
				{
					"line": 9,
					"column": 5
				}
			],
			"path": [
				"nodeByUri",
				"seo",
				"breadcrumbs"
			]
		}
	],
	"data": {
		"nodeByUri": {
			"__typename": "ContentType",
			"seo": {
				"__typename": "RankMathPostTypeSeo",
				"title": "Blog - Website Name",
				"description": "Blog page SEO description",
				"breadcrumbs": null
			}
		}
	},
	"extensions": {
		"debug": [],
		"queryAnalyzer": {
			"keys": "f99ddc3f7fbf19aeff4b9a5da13138928f5f3ea80617099f0537512a628a3a6d graphql:Query operation:rankMathNodeByUri cG9zdF90eXBlOnBvc3Q=",
			"keysLength": 127,
			"keysCount": 4,
			"skippedKeys": "",
			"skippedKeysSize": 0,
			"skippedKeysCount": 0,
			"skippedTypes": []
		}
	}
} 

@justlevine
Copy link
Member

Hey @MonPetitUd

#90 should fix this issue. Please feel free to test.

(I'm putting it through the final paces myself, at which point I'll merge and start the release process).

@justlevine
Copy link
Member

(This is closed automatically on merge, if you're still running into trouble, comment here and I'll repoen)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: confirmed 📍 The issue has been confirmed and reproduced. type: bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants