bdunogier / ezplatform-graphql-bundle

GraphQL server for eZ Platform, the open source Symfony CMS.
13 stars 6 forks source link

Interface field Node.id expects type ID! but TemplateLookContent.id is type String #89

Open amine-betari opened 3 years ago

amine-betari commented 3 years ago

Under eZ Platform 3.1.4 we had an issue with children of given content not showing.

We found that there is a field named 3d_file that is causing concern, so we renamed it to avoid the problem

but right after we got this error which still prevents displaying the children of a given content

Here is the error :

{"type":"https:\/\/tools.ietf.org\/html\/rfc2616#section-10","title":"An error occurred","status":500,"detail":"Interface field Node.id expects type ID! but TemplateLookContent.id is type String.","class":"GraphQL\\Error\\InvariantViolation","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/var\/www\/html\/project\/ezplatform\/vendor\/webonyx\/graphql-php\/src\/Type\/Schema.php","line":472,"args":[]},{"namespace":"GraphQL\\Type","short_class":"Schema","class":"GraphQL\\Type\\Schema","type":"->","function":"assertValid","file":"\/var\/www\/html\/project\/ezplatform\/vendor\/overblog\/graphql-bundle\/src\/Definition\/Type\/SchemaExtension\/ValidatorExtension.php","line":11,"args":[]},{"namespace":"Overblog\\GraphQLBundle\\Definition\\Type\\SchemaExtension","short_class":"ValidatorExtension","class":"Overblog\\GraphQLBundle\\Definition\\Type\\SchemaExtension\\ValidatorExtension","type":"->","function":"process","file":"\/var\/www\/html\/project\/ezplatform\/vendor\/overblog\/graphql-bundle\/src\/Definition\/Type\/ExtensibleSchema.php","line":51,"args":[["object","Overblog\\GraphQLBundle\\Definition\\Type\\ExtensibleSchema"]]},{"namespace":"Overblog\\GraphQLBundle\\Definition\\Type","short_class":"ExtensibleSchema","class":"Overblog\\GraphQLBundle\\Definition\\Type\\ExtensibleSchema","type":"->","function":"processExtensions","file":"\/var\/www\/html\/project\/ezplatform\/vendor\/overblog\/graphql-bundle\/src\/Request\/Executor.php","line":146,"args":[]},{"namespace":"Overblog\\GraphQLBundle\\Request","short_class":"Executor","class":"Overblog\\GraphQLBundle\\Request\\Executor","type":"->","function":"execute","file":"\/var\/www\/html\/project\/ezplatform\/vendor\/overblog\/graphql-bundle\/src\/Controller\/GraphController.php","line":159,"args":[["null",null],["array",{"query":["string","\n {\n _repository {\n location(locationId: 11988) {\n pathString\n children(sortBy: [_path, ], first:10 ) {\n totalCount\n pages {\n number\n cursor\n }\n edges {\n node {\n id\n remoteId\n invisible\n hidden\n priority\n pathString\n \n content {\n _thumbnail {\n uri\n alternativeText\n }\n _name\n _info {\n id\n name\n remoteId\n mainLanguageCode\n owner {\n name\n }\n currentVersion {\n versionNumber\n creator {\n name\n }\n languageCodes\n }\n contentType {\n name\n identifier\n }\n section {\n name\n }\n publishedDate {\n timestamp\n }\n modificationDate {\n timestamp\n }\n }\n }\n }\n }\n }\n }\n }\n }"],"variables":["null",null],"operationName":["null",null]}]]},{"namespace":"Overblog\\GraphQLBundle\\Controller","short_class":"GraphController","class":"Overblog\\GraphQLBundle\\Controller\\GraphController","type":"->","function":"processNormalQuery","file":"\/var\/www\/html\/project\/ezplatform\/vendor\/overblog\/graphql-bundle\/src\/Controller\/GraphController.php","line":119,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["null",null]]},{"namespace":"Overblog\\GraphQLBundle\\Controller","short_class":"GraphController","class":"Overblog\\GraphQLBundle\\Controller\\GraphController","type":"->","function":"processQuery","file":"\/var\/www\/html\/project\/ezplatform\/vendor\/overblog\/graphql-bundle\/src\/Controller\/GraphController.php","line":88,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["null",null],["boolean",false]]},{"namespace":"Overblog\\GraphQLBundle\\Controller","short_class":"GraphController","class":"Overblog\\GraphQLBundle\\Controller\\GraphController","type":"->","function":"createResponse","file":"\/var\/www\/html\/project\/ezplatform\/vendor\/overblog\/graphql-bundle\/src\/Controller\/GraphController.php","line":59,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["null",null],["boolean",false]]},{"namespace":"Overblog\\GraphQLBundle\\Controller","short_class":"GraphController","class":"Overblog\\GraphQLBundle\\Controller\\GraphController","type":"->","function":"endpointAction","file":"\/var\/www\/html\/project\/ezplatform\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":157,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["null",null]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"HttpKernel","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"->","function":"handleRaw","file":"\/var\/www\/html\/project\/ezplatform\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":79,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["integer",1]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"HttpKernel","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"->","function":"handle","file":"\/var\/www\/html\/project\/ezplatform\/vendor\/symfony\/http-kernel\/Kernel.php","line":196,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["integer",1],["boolean",true]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"Kernel","class":"Symfony\\Component\\HttpKernel\\Kernel","type":"->","function":"handle","file":"\/var\/www\/html\/project\/ezplatform\/public\/index.php","line":42,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"]]}]}

amine-betari commented 3 years ago

Hi @bdunogier

F.Y.I: We have moved to Ibexa 3.2.3. We still have the same problem

Thanks

volkanakb commented 3 years ago

Hi @amine-betari @bdunogier , we had the same problem. This happens usually after migration. Check your Contenttypes, there should be a contenttype group called "Setup" within there should be the contenttypes "template_look" and may be "common_ini_settings". Delete all the contentobjects from the database with the corresponding contentclass_id (in my case it was 15 and 14) after that delete the contenttypes from the backend and regenerate your grapqhl shema with: php bin/console ibexa:graphql:generate-schema

i guess the problem is that template_look has a field with identifier 'id'

ChrisMoutsos commented 2 years ago

Hi, this is a problem without any old Content Types from "Setup" group. All it requires to reproduce the issue is an attribute with an identifier id. @bdunogier is there a workaround for this other than manually editing the yaml file to remove id field?

bdunogier commented 2 years ago

Hello @ChrisMoutsos & others. It actually turns out that a workaround was implemented for it last year: https://github.com/ezsystems/ezplatform-graphql/pull/98. Fields named id will be renamed during generation. It was part of the 3.3.2 release.

As far as I know, version 2.3.1 of the graphql package should be compatible with earlier versions of Ibexa DXP / eZ Platform.