Closed vieko closed 5 years ago
Is it possible to get a DB dump, composer.lock and composer.json files over email to support@craftcms.com?
Also, if it is, can you reference this github issue?
From the error it looks like you had a Matrix field that was converted to an Entries field. Unfortunately Craft doesn’t currently have a way to clean up after itself when that happens, so the Matrix blocks still exist in the database.
I’ve just updated getAllBlockTypes()
to ignore any block types that are no longer associated with a Matrix field, which should fix this error for you.
To get the fix early, change your craftcms/cms
requirement in composer.json to:
"require": {
"craftcms/cms": "dev-develop#16c1db5676c7c5eab63c56c927c9f576466073ee as 3.3.0.1",
"...": "..."
}
Then run composer update
.
Thank you Brandon, good to know! will give it a try.
Did this end up fixing it for you @vieko ?
This did fix it for me.
@brandonkelly I'm getting this error ({"error": "Something went wrong when processing the GraphQL query."}
), only on one environment out of 3, sending this:
query gtm {
globalSets (id: 4) {
... on services_GlobalSet {
GTM
}
}
}
This works perfectly fine when launched from http://whateverEnvUrl/admin/graphiql?schemaUid=whatever
, but when calling it from /admin/actions/graphql/api
this fails on my production server. (not on staging, not locally).
Any hint? (the field has always been there, never changed).
On the logs:
2020-09-07 16:43:32 [-][106432][-][error][craft\errors\GqlException] craft\errors\GqlException: Tried to load an unregistered type „services_GlobalSet”. This can indicate both a typo in the query or an issue with the schema used. in /srv/www/phineo-wok-stage.siruphosting.net/web/htdocs/craft/vendor/craftcms/cms/src/gql/TypeLoader.php:39
Stack trace:
#0 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Type/Schema.php(319): craft\gql\TypeLoader::loadType('services_Global...')
#1 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Type/Schema.php(212): GraphQL\Type\Schema->loadType('services_Global...')
#2 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Utils/AST.php(504): GraphQL\Type\Schema->getType('services_Global...')
#3 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Utils/TypeInfo.php(66): GraphQL\Utils\AST::typeFromAST(Object(GraphQL\Type\Schema), Object(GraphQL\Language\AST\NamedTypeNode))
#4 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Validator/Rules/OverlappingFieldsCanBeMerged.php(825): GraphQL\Utils\TypeInfo::typeFromAST(Object(GraphQL\Type\Schema), Object(GraphQL\Language\AST\NamedTypeNode))
#5 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Validator/Rules/OverlappingFieldsCanBeMerged.php(739): GraphQL\Validator\Rules\OverlappingFieldsCanBeMerged->internalCollectFieldsAndFragmentNames(Object(GraphQL\Validator\ValidationContext), NULL, Object(GraphQL\Language\AST\SelectionSetNode), Array, Array)
#6 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Validator/Rules/OverlappingFieldsCanBeMerged.php(162): GraphQL\Validator\Rules\OverlappingFieldsCanBeMerged->getFieldsAndFragmentNames(Object(GraphQL\Validator\ValidationContext), NULL, Object(GraphQL\Language\AST\SelectionSetNode))
#7 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Validator/Rules/OverlappingFieldsCanBeMerged.php(71): GraphQL\Validator\Rules\OverlappingFieldsCanBeMerged->findConflictsWithinSelectionSet(Object(GraphQL\Validator\ValidationContext), NULL, Object(GraphQL\Language\AST\SelectionSetNode))
#8 [internal function]: GraphQL\Validator\Rules\OverlappingFieldsCanBeMerged->GraphQL\Validator\Rules\{closure}(Object(GraphQL\Language\AST\SelectionSetNode), 'selectionSet', Object(GraphQL\Language\AST\FieldNode), Array, Array)
#9 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Language/Visitor.php(372): call_user_func_array(Object(Closure), Array)
#10 [internal function]: GraphQL\Language\Visitor::GraphQL\Language\{closure}(Object(GraphQL\Language\AST\SelectionSetNode), 'selectionSet', Object(GraphQL\Language\AST\FieldNode), Array, Array)
#11 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Language/Visitor.php(426): call_user_func_array(Object(Closure), Array)
#12 [internal function]: GraphQL\Language\Visitor::GraphQL\Language\{closure}(Object(GraphQL\Language\AST\SelectionSetNode), 'selectionSet', Object(GraphQL\Language\AST\FieldNode), Array, Array)
#13 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Language/Visitor.php(251): call_user_func(Object(Closure), Object(GraphQL\Language\AST\SelectionSetNode), 'selectionSet', Object(GraphQL\Language\AST\FieldNode), Array, Array)
#14 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Validator/DocumentValidator.php(259): GraphQL\Language\Visitor::visit(Object(GraphQL\Language\AST\DocumentNode), Array)
#15 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/Validator/DocumentValidator.php(96): GraphQL\Validator\DocumentValidator::visitUsingRules(Object(GraphQL\Type\Schema), Object(GraphQL\Utils\TypeInfo), Object(GraphQL\Language\AST\DocumentNode), Array)
#16 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/GraphQL.php(140): GraphQL\Validator\DocumentValidator::validate(Object(GraphQL\Type\Schema), Object(GraphQL\Language\AST\DocumentNode), Array)
#17 /srv/www/liveEnv/web/htdocs/craft/vendor/webonyx/graphql-php/src/GraphQL.php(85): GraphQL\GraphQL::promiseToExecute(Object(GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter), Object(GraphQL\Type\Schema), 'query gtm {\n ...', NULL, NULL, NULL, NULL, NULL, Array)
#18 /srv/www/liveEnv/web/htdocs/craft/vendor/craftcms/cms/src/services/Gql.php(474): GraphQL\GraphQL::executeQuery(Object(GraphQL\Type\Schema), 'query gtm {\n ...', NULL, NULL, NULL, NULL, NULL, Array)
#19 /srv/www/liveEnv/web/htdocs/craft/vendor/craftcms/cms/src/controllers/GraphqlController.php(149): craft\services\Gql->executeQuery(Object(craft\models\GqlSchema), 'query gtm {\n ...', NULL, NULL, false)
#20 [internal function]: craft\controllers\GraphqlController->actionApi()
#21 /srv/www/liveEnv/web/htdocs/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#22 /srv/www/liveEnv/web/htdocs/craft/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#23 /srv/www/liveEnv/web/htdocs/craft/vendor/craftcms/cms/src/web/Controller.php(181): yii\base\Controller->runAction('api', Array)
#24 /srv/www/liveEnv/web/htdocs/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('api', Array)
#25 /srv/www/liveEnv/web/htdocs/craft/vendor/craftcms/cms/src/web/Application.php(294): yii\base\Module->runAction('graphql/api', Array)
#26 /srv/www/liveEnv/web/htdocs/craft/vendor/craftcms/cms/src/web/Application.php(597): craft\web\Application->runAction('graphql/api', Array)
#27 /srv/www/liveEnv/web/htdocs/craft/vendor/craftcms/cms/src/web/Application.php(273): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#28 /srv/www/liveEnv/web/htdocs/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#29 /srv/www/liveEnv/web/htdocs/index.php(21): yii\base\Application->run()
#30 {main}
2020-09-07 16:43:32 [-][106432][-][info][application] $_GET = [
'p' => 'admin/actions/graphql/api'
]
JFYI, the call:
window.fetch('/admin/actions/graphql/api', {
method: 'POST',
body: `query gtm {
globalSets (id: 4) {
... on services_GlobalSet {
GTM
}
}
}`,
headers: {
Authorization: bearerToken,
'Content-Type': 'application/graphql'
}
})
@ricricucit is the schema associated with the token configured to actually see the relevant global set?
yep
@ricricucit is it possible to get a DB dump and the composer.json/composer.lock files to reproduce? If so, can you send the over to support@craftcms.com and reference this issue?
ok, sending a WeTransfer.
@ricricucit did you find a solution for this? I'm running into the exact same issue.
sorry, but unfortunately I do not remember. Checking in my inbox, the communication with CraftCMS support have been dropped, without a clear solution from anyone, but looking at the client's website...things are actually working, so I solved it, somehow.......that's all I can say...
@ricricucit @roelvanhintum for posterity, here is the response I sent you on Sep 09, 2020:
Enrico,
that's really odd behavior.
It seems that your server configuration is stripping with the Authorization header.
There are multiple signs that point to this, but the most certain proof is that if I shoot a {ping} query at the server using a Bearer token with a random value, the server never complains about an invalid token, which means that the Authorization header is missing and the server falls back to the public schema.
I would probably not call it a dropped conversation with no real solution from anyone.
ok, I have dropped the convo, and: sorry @andris-sevcenko. Re-reading my message, it sounded like blaming support, which was not at all my intention. I do remember that the hint wasn't useful, tho...so I might have solved it using a new DB dump or something like that. @roelvanhintum: now @andris-sevcenko is here, you can ask him 👋🙂
@ricricucit all good, Ricardo.
@roelvanhintum if you look at the token listing page, does the token "last used" time update after each request?
@andris-sevcenko i'm using the public scheme, so tokens shouldn't mather right? Ping does work, but all the other stuff does not. I'm guessing the public scheme settings aren't enforced from the project config. I'll try enabling admin to verify this.
Also, I am going to try copying my database to the accept server to see if that fixes it. The acceptance db is setup using the project config, instead of a database copy, so maybe that is the problem.
@andris-sevcenko somehow i ended up with 2 public schemes in my accept environment (allowAdminChanges
has never been enabled here). The first one is empty and probably used for public queries. Removing the empty (no scope) one solves the problem.
@roelvanhintum huh. That's odd. Let me know if you ever encounter this again!
Description
I get the following error regardless of what query I run:
{"error": "Something went wrong when processing the GraphQL query."}
Looks like we are running into a type error when generating the schema:
Steps to reproduce
Additional info