Closed benfeather closed 2 months ago
In Craft 5, we can change a field's slug on an entry type, however this throws an error when using hyper and GraphQL.
It works correctly if I don't change the slug on the field instance and update my GQL query.
Here's the full error:
"errors": [ { "debugMessage": "Tried to load an unregistered type \"popupLink_Entry_LinkType\". This can indicate both a typo in the query or an issue with the schema used.", "message": "Internal server error", "extensions": { "category": "internal" }, "trace": [ { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Type/Schema.php", "line": 350, "call": "craft\\gql\\TypeLoader::loadType('popupLink_Entry_LinkType')" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Type/Schema.php", "line": 326, "call": "GraphQL\\Type\\Schema::loadType('popupLink_Entry_LinkType')" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1267, "call": "GraphQL\\Type\\Schema::getType('popupLink_Entry_LinkType')" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 974, "call": "GraphQL\\Executor\\ReferenceExecutor::ensureValidRuntimeType('popupLink_Entry_LinkType', GraphQLType: HyperLinkInterface, instance of GraphQL\\Type\\Definition\\ResolveInfo, instance of verbb\\hyper\\links\\Entry)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 789, "call": "GraphQL\\Executor\\ReferenceExecutor::completeAbstractValue(GraphQLType: HyperLinkInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(3), instance of verbb\\hyper\\links\\Entry)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 654, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: HyperLinkInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(3), instance of verbb\\hyper\\links\\Entry)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 887, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValueCatchingError(GraphQLType: HyperLinkInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(3), instance of verbb\\hyper\\links\\Entry)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 761, "call": "GraphQL\\Executor\\ReferenceExecutor::completeListValue(GraphQLType: HyperLinkInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(2), instance of verbb\\hyper\\models\\LinkCollection(1))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 740, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: HyperLinkInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(2), instance of verbb\\hyper\\models\\LinkCollection(1))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 654, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: HyperLinkInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(2), instance of verbb\\hyper\\models\\LinkCollection(1))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 556, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValueCatchingError(GraphQLType: HyperLinkInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(2), instance of verbb\\hyper\\models\\LinkCollection(1))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1195, "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: popup_GlobalSet, instance of craft\\elements\\GlobalSet, instance of ArrayObject(1), array(2))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1145, "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields(GraphQLType: popup_GlobalSet, instance of craft\\elements\\GlobalSet, array(1), instance of ArrayObject(5))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1105, "call": "GraphQL\\Executor\\ReferenceExecutor::collectAndExecuteSubfields(GraphQLType: popup_GlobalSet, instance of ArrayObject(1), array(1), instance of craft\\elements\\GlobalSet)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 973, "call": "GraphQL\\Executor\\ReferenceExecutor::completeObjectValue(GraphQLType: popup_GlobalSet, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of craft\\elements\\GlobalSet)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 789, "call": "GraphQL\\Executor\\ReferenceExecutor::completeAbstractValue(GraphQLType: GlobalSetInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of craft\\elements\\GlobalSet)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 654, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: GlobalSetInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of craft\\elements\\GlobalSet)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 556, "call": "GraphQL\\Executor\\ReferenceExecutor::completeValueCatchingError(GraphQLType: GlobalSetInterface, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of craft\\elements\\GlobalSet)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 1195, "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: Query, null, instance of ArrayObject(1), array(1))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 264, "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields(GraphQLType: Query, null, array(0), instance of ArrayObject(8))" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php", "line": 215, "call": "GraphQL\\Executor\\ReferenceExecutor::executeOperation(instance of GraphQL\\Language\\AST\\OperationDefinitionNode, null)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/Executor/Executor.php", "line": 156, "call": "GraphQL\\Executor\\ReferenceExecutor::doExecute()" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/GraphQL.php", "line": 161, "call": "GraphQL\\Executor\\Executor::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, instance of GraphQL\\Language\\AST\\DocumentNode, null, array(2), null, 'global', null)" }, { "file": "/var/www/html/vendor/webonyx/graphql-php/src/GraphQL.php", "line": 93, "call": "GraphQL\\GraphQL::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, 'query global($siteId: [QueryArgument] = 1) {\n banner: globalSet(handle: \"banner\", siteId: $siteId) {\n ... on banner_GlobalSet {\n enableBanner\n copy: bannerCopy\n link: pageLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n }\n }\n contact: globalSet(handle: \"contact\", siteId: $siteId) {\n ... on contact_GlobalSet {\n phoneNumber\n emailAddress\n socialMedia {\n ... on blockSocialPlatform_Entry {\n icon {\n inline\n }\n title\n url\n }\n }\n }\n }\n footerContent: globalSet(handle: \"footer\", siteId: $siteId) {\n ... on footer_GlobalSet {\n title: footerTitle\n copy: footerCopy\n }\n }\n footerNav: entries(section: \"footerNav\", siteId: $siteId) {\n ... on footerLink_Entry {\n id\n title\n link: pageLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n }\n }\n headerNav: entries(\n level: 1\n siteId: $siteId\n section: \"headerNav\"\n type: [\"megaMenu\", \"menu\", \"link\"]\n ) {\n ... on headerMegaMenu_Entry {\n ...headerNavMegaMenu\n }\n ... on headerMenu_Entry {\n ...headerNavMenu\n }\n ... on headerLink_Entry {\n ...headerNavLink\n }\n }\n newsletter: globalSet(handle: \"footer\", siteId: $siteId) {\n ... on newsletter_GlobalSet {\n title: newsletterTitle\n copy: newsletterCopy\n form {\n id\n }\n }\n }\n placeholder: globalSet(handle: \"placeholder\", siteId: $siteId) {\n ... on placeholder_GlobalSet {\n articleImage: placeholderArticleImage {\n ...imageFragment\n }\n productImage: placeholderProductImage {\n ...imageFragment\n }\n }\n }\n popup: globalSet(handle: \"popup\", siteId: $siteId) {\n ... on popup_GlobalSet {\n enablePopup\n title: popupTitle\n copy: popupCopy\n link: popupLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n image: popupImage {\n ...imageFragment\n }\n }\n }\n}\n\nfragment headerNavMegaMenu on headerMegaMenu_Entry {\n id\n slug\n title\n type: typeHandle\n children(type: \"menu\") {\n ...headerNavMenu\n }\n}\n\nfragment headerNavMenu on headerMenu_Entry {\n id\n slug\n title\n subtitle\n type: typeHandle\n icon {\n ... on icon_Icon {\n inline\n }\n }\n children(type: \"link\") {\n ...headerNavLink\n }\n}\n\nfragment headerNavLink on headerLink_Entry {\n id\n slug\n title\n subtitle\n type: typeHandle\n highlightLink\n link: pageLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n}\n\nfragment imageFragment on images_Asset {\n id\n alt\n height\n title\n type: mimeType\n url\n width\n}\n', null, array(2), null, 'global', null, array(26))" }, { "file": "/var/www/html/vendor/craftcms/cms/src/services/Gql.php", "line": 510, "call": "GraphQL\\GraphQL::executeQuery(instance of GraphQL\\Type\\Schema, 'query global($siteId: [QueryArgument] = 1) {\n banner: globalSet(handle: \"banner\", siteId: $siteId) {\n ... on banner_GlobalSet {\n enableBanner\n copy: bannerCopy\n link: pageLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n }\n }\n contact: globalSet(handle: \"contact\", siteId: $siteId) {\n ... on contact_GlobalSet {\n phoneNumber\n emailAddress\n socialMedia {\n ... on blockSocialPlatform_Entry {\n icon {\n inline\n }\n title\n url\n }\n }\n }\n }\n footerContent: globalSet(handle: \"footer\", siteId: $siteId) {\n ... on footer_GlobalSet {\n title: footerTitle\n copy: footerCopy\n }\n }\n footerNav: entries(section: \"footerNav\", siteId: $siteId) {\n ... on footerLink_Entry {\n id\n title\n link: pageLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n }\n }\n headerNav: entries(\n level: 1\n siteId: $siteId\n section: \"headerNav\"\n type: [\"megaMenu\", \"menu\", \"link\"]\n ) {\n ... on headerMegaMenu_Entry {\n ...headerNavMegaMenu\n }\n ... on headerMenu_Entry {\n ...headerNavMenu\n }\n ... on headerLink_Entry {\n ...headerNavLink\n }\n }\n newsletter: globalSet(handle: \"footer\", siteId: $siteId) {\n ... on newsletter_GlobalSet {\n title: newsletterTitle\n copy: newsletterCopy\n form {\n id\n }\n }\n }\n placeholder: globalSet(handle: \"placeholder\", siteId: $siteId) {\n ... on placeholder_GlobalSet {\n articleImage: placeholderArticleImage {\n ...imageFragment\n }\n productImage: placeholderProductImage {\n ...imageFragment\n }\n }\n }\n popup: globalSet(handle: \"popup\", siteId: $siteId) {\n ... on popup_GlobalSet {\n enablePopup\n title: popupTitle\n copy: popupCopy\n link: popupLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n image: popupImage {\n ...imageFragment\n }\n }\n }\n}\n\nfragment headerNavMegaMenu on headerMegaMenu_Entry {\n id\n slug\n title\n type: typeHandle\n children(type: \"menu\") {\n ...headerNavMenu\n }\n}\n\nfragment headerNavMenu on headerMenu_Entry {\n id\n slug\n title\n subtitle\n type: typeHandle\n icon {\n ... on icon_Icon {\n inline\n }\n }\n children(type: \"link\") {\n ...headerNavLink\n }\n}\n\nfragment headerNavLink on headerLink_Entry {\n id\n slug\n title\n subtitle\n type: typeHandle\n highlightLink\n link: pageLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n}\n\nfragment imageFragment on images_Asset {\n id\n alt\n height\n title\n type: mimeType\n url\n width\n}\n', null, array(2), null, 'global', null, array(26))" }, { "file": "/var/www/html/vendor/craftcms/cms/src/controllers/GraphqlController.php", "line": 194, "call": "craft\\services\\Gql::executeQuery(instance of craft\\models\\GqlSchema, 'query global($siteId: [QueryArgument] = 1) {\n banner: globalSet(handle: \"banner\", siteId: $siteId) {\n ... on banner_GlobalSet {\n enableBanner\n copy: bannerCopy\n link: pageLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n }\n }\n contact: globalSet(handle: \"contact\", siteId: $siteId) {\n ... on contact_GlobalSet {\n phoneNumber\n emailAddress\n socialMedia {\n ... on blockSocialPlatform_Entry {\n icon {\n inline\n }\n title\n url\n }\n }\n }\n }\n footerContent: globalSet(handle: \"footer\", siteId: $siteId) {\n ... on footer_GlobalSet {\n title: footerTitle\n copy: footerCopy\n }\n }\n footerNav: entries(section: \"footerNav\", siteId: $siteId) {\n ... on footerLink_Entry {\n id\n title\n link: pageLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n }\n }\n headerNav: entries(\n level: 1\n siteId: $siteId\n section: \"headerNav\"\n type: [\"megaMenu\", \"menu\", \"link\"]\n ) {\n ... on headerMegaMenu_Entry {\n ...headerNavMegaMenu\n }\n ... on headerMenu_Entry {\n ...headerNavMenu\n }\n ... on headerLink_Entry {\n ...headerNavLink\n }\n }\n newsletter: globalSet(handle: \"footer\", siteId: $siteId) {\n ... on newsletter_GlobalSet {\n title: newsletterTitle\n copy: newsletterCopy\n form {\n id\n }\n }\n }\n placeholder: globalSet(handle: \"placeholder\", siteId: $siteId) {\n ... on placeholder_GlobalSet {\n articleImage: placeholderArticleImage {\n ...imageFragment\n }\n productImage: placeholderProductImage {\n ...imageFragment\n }\n }\n }\n popup: globalSet(handle: \"popup\", siteId: $siteId) {\n ... on popup_GlobalSet {\n enablePopup\n title: popupTitle\n copy: popupCopy\n link: popupLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n image: popupImage {\n ...imageFragment\n }\n }\n }\n}\n\nfragment headerNavMegaMenu on headerMegaMenu_Entry {\n id\n slug\n title\n type: typeHandle\n children(type: \"menu\") {\n ...headerNavMenu\n }\n}\n\nfragment headerNavMenu on headerMenu_Entry {\n id\n slug\n title\n subtitle\n type: typeHandle\n icon {\n ... on icon_Icon {\n inline\n }\n }\n children(type: \"link\") {\n ...headerNavLink\n }\n}\n\nfragment headerNavLink on headerLink_Entry {\n id\n slug\n title\n subtitle\n type: typeHandle\n highlightLink\n link: pageLink {\n ... on HyperLinkInterface {\n link\n linkText\n }\n }\n}\n\nfragment imageFragment on images_Asset {\n id\n alt\n height\n title\n type: mimeType\n url\n width\n}\n', null, 'global', true)" }, { "call": "craft\\controllers\\GraphqlController::actionApi()" }, { "file": "/var/www/html/vendor/yiisoft/yii2/base/InlineAction.php", "line": 57, "function": "call_user_func_array(array(2), array(0))" }, { "file": "/var/www/html/vendor/yiisoft/yii2/base/Controller.php", "line": 178, "call": "yii\\base\\InlineAction::runWithParams(array(2))" }, { "file": "/var/www/html/vendor/yiisoft/yii2/base/Module.php", "line": 552, "call": "yii\\base\\Controller::runAction('api', array(2))" }, { "file": "/var/www/html/vendor/craftcms/cms/src/web/Application.php", "line": 349, "call": "yii\\base\\Module::runAction('graphql/api', array(2))" }, { "file": "/var/www/html/vendor/craftcms/cms/src/web/Application.php", "line": 650, "call": "craft\\web\\Application::runAction('graphql/api', array(2))" }, { "file": "/var/www/html/vendor/craftcms/cms/src/web/Application.php", "line": 311, "call": "craft\\web\\Application::_processActionRequest(instance of craft\\web\\Request)" }, { "file": "/var/www/html/vendor/yiisoft/yii2/base/Application.php", "line": 384, "call": "craft\\web\\Application::handleRequest(instance of craft\\web\\Request)" }, { "file": "/var/www/html/web/index.php", "line": 17, "call": "yii\\base\\Application::run()" } ] } ],
5.0.0
2.0.0-beta.7
Yes
No response
Fixed for the next release. To get this early, run composer require verbb/hyper:"dev-craft-5 as 2.0.0-beta.7".
composer require verbb/hyper:"dev-craft-5 as 2.0.0-beta.7"
Fixed in 2.0.0-beta.8
Describe the bug
In Craft 5, we can change a field's slug on an entry type, however this throws an error when using hyper and GraphQL.
It works correctly if I don't change the slug on the field instance and update my GQL query.
Here's the full error:
Steps to reproduce
Craft CMS version
5.0.0
Plugin version
2.0.0-beta.7
Multi-site?
Yes
Additional context
No response