Open thomas4Bitcraft opened 4 months ago
It seems to be fine. Are there any errors in your log file?
@jasonvarga Yes I have this error in the logs:
[2024-05-27 14:04:30] local.ERROR: Cannot query field "ping" on type "Query". {"exception":"[object] (GraphQL\\Error\\Error(code: 0): Cannot query field \"ping\" on type \"Query\". at /home/vagrant/code/xyz/vendor/webonyx/graphql-php/src/Validator/Rules/FieldsOnCorrectType.php:43)
[stacktrace]
#0 /home/vagrant/code/xyz/vendor/webonyx/graphql-php/src/Language/Visitor.php(390): GraphQL\\Validator\\Rules\\FieldsOnCorrectType->GraphQL\\Validator\\Rules\\{closure}()
#1 /home/vagrant/code/xyz/vendor/webonyx/graphql-php/src/Language/Visitor.php(453): GraphQL\\Language\\Visitor::GraphQL\\Language\\{closure}()
#2 /home/vagrant/code/xyz/vendor/webonyx/graphql-php/src/Language/Visitor.php(263): GraphQL\\Language\\Visitor::GraphQL\\Language\\{closure}()
#3 /home/vagrant/code/xyz/vendor/webonyx/graphql-php/src/Validator/DocumentValidator.php(118): GraphQL\\Language\\Visitor::visit()
#4 /home/vagrant/code/xyz/vendor/webonyx/graphql-php/src/GraphQL.php(154): GraphQL\\Validator\\DocumentValidator::validate()
#5 /home/vagrant/code/xyz/vendor/webonyx/graphql-php/src/GraphQL.php(96): GraphQL\\GraphQL::promiseToExecute()
#6 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Support/ExecutionMiddleware/GraphqlExecutionMiddleware.php(32): GraphQL\\GraphQL::executeQuery()
#7 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Support/ExecutionMiddleware/AbstractExecutionMiddleware.php(31): Rebing\\GraphQL\\Support\\ExecutionMiddleware\\GraphqlExecutionMiddleware->handle()
#8 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Rebing\\GraphQL\\Support\\ExecutionMiddleware\\AbstractExecutionMiddleware->resolve()
#9 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Support/ExecutionMiddleware/AbstractExecutionMiddleware.php(33): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#10 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Support/ExecutionMiddleware/AddAuthUserContextValueMiddleware.php(28): Rebing\\GraphQL\\Support\\ExecutionMiddleware\\AbstractExecutionMiddleware->Rebing\\GraphQL\\Support\\ExecutionMiddleware\\{closure}()
#11 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Support/ExecutionMiddleware/AbstractExecutionMiddleware.php(31): Rebing\\GraphQL\\Support\\ExecutionMiddleware\\AddAuthUserContextValueMiddleware->handle()
#12 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Rebing\\GraphQL\\Support\\ExecutionMiddleware\\AbstractExecutionMiddleware->resolve()
#13 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Support/ExecutionMiddleware/AbstractExecutionMiddleware.php(33): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#14 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Support/ExecutionMiddleware/AutomaticPersistedQueriesMiddleware.php(42): Rebing\\GraphQL\\Support\\ExecutionMiddleware\\AbstractExecutionMiddleware->Rebing\\GraphQL\\Support\\ExecutionMiddleware\\{closure}()
#15 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Support/ExecutionMiddleware/AbstractExecutionMiddleware.php(31): Rebing\\GraphQL\\Support\\ExecutionMiddleware\\AutomaticPersistedQueriesMiddleware->handle()
#16 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Rebing\\GraphQL\\Support\\ExecutionMiddleware\\AbstractExecutionMiddleware->resolve()
#17 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Support/ExecutionMiddleware/AbstractExecutionMiddleware.php(33): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#18 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Support/ExecutionMiddleware/ValidateOperationParamsMiddleware.php(39): Rebing\\GraphQL\\Support\\ExecutionMiddleware\\AbstractExecutionMiddleware->Rebing\\GraphQL\\Support\\ExecutionMiddleware\\{closure}()
#19 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Support/ExecutionMiddleware/AbstractExecutionMiddleware.php(31): Rebing\\GraphQL\\Support\\ExecutionMiddleware\\ValidateOperationParamsMiddleware->handle()
#20 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Rebing\\GraphQL\\Support\\ExecutionMiddleware\\AbstractExecutionMiddleware->resolve()
#21 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#22 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(129): Illuminate\\Pipeline\\Pipeline->then()
#23 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/GraphQL.php(169): Illuminate\\Pipeline\\Pipeline->thenReturn()
#24 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/GraphQL.php(151): Rebing\\GraphQL\\GraphQL->executeViaMiddleware()
#25 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/GraphQL.php(137): Rebing\\GraphQL\\GraphQL->executeAndReturnResult()
#26 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/GraphQLController.php(41): Rebing\\GraphQL\\GraphQL->execute()
#27 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/Helpers.php(24): Rebing\\GraphQL\\GraphQLController->Rebing\\GraphQL\\{closure}()
#28 /home/vagrant/code/xyz/vendor/rebing/graphql-laravel/src/GraphQLController.php(37): Rebing\\GraphQL\\Helpers::applyEach()
#29 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): Rebing\\GraphQL\\GraphQLController->query()
#30 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction()
#31 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Routing/Route.php(260): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#32 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Routing/Route.php(206): Illuminate\\Routing\\Route->runController()
#33 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Routing/Router.php(806): Illuminate\\Routing\\Route->run()
#34 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#35 /home/vagrant/code/xyz/vendor/statamic/cms/src/Http/Middleware/HandleToken.php(13): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#36 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\HandleToken->handle()
#37 /home/vagrant/code/xyz/vendor/statamic/cms/src/Http/Middleware/RequireStatamicPro.php(17): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#38 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\RequireStatamicPro->handle()
#39 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#40 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\\Pipeline\\Pipeline->then()
#41 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\\Routing\\Router->runRouteWithinStack()
#42 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\\Routing\\Router->runRoute()
#43 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\\Routing\\Router->dispatchToRoute()
#44 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch()
#45 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#46 /home/vagrant/code/xyz/vendor/statamic/cms/src/Http/Middleware/StopImpersonating.php(12): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#47 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\StopImpersonating->handle()
#48 /home/vagrant/code/xyz/vendor/statamic/cms/src/Http/Middleware/DisableFloc.php(17): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#49 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\DisableFloc->handle()
#50 /home/vagrant/code/xyz/vendor/statamic/cms/src/Http/Middleware/CheckMultisite.php(15): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#51 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CheckMultisite->handle()
#52 /home/vagrant/code/xyz/vendor/statamic/cms/src/Http/Middleware/CheckComposerJsonScripts.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#53 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CheckComposerJsonScripts->handle()
#54 /home/vagrant/code/xyz/vendor/statamic/cms/src/Http/Middleware/PoweredByHeader.php(18): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#55 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\PoweredByHeader->handle()
#56 /home/vagrant/code/xyz/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(59): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#57 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle()
#58 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#59 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#60 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#61 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#62 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#63 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#64 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#65 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\ValidatePostSize->handle()
#66 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#67 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#68 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#69 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle()
#70 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#71 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#72 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#73 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then()
#74 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#75 /home/vagrant/code/xyz/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1172): Illuminate\\Foundation\\Http\\Kernel->handle()
#76 /home/vagrant/code/xyz/public/index.php(17): Illuminate\\Foundation\\Application->handleRequest()
#77 {main}
"}
@jasonvarga Could the reason be the eloquent addon?
Seems to be working fine for me, even with the Eloquent Driver 🤔
What does your config/statamic/graphql.php
file look like?
@duncanmcclean This is the current config:
<?php
return [
/*
|--------------------------------------------------------------------------
| GraphQL
|--------------------------------------------------------------------------
|
| Here you may enable the GraphQL API, and select which resources
| are available to be queried, depending on your site's needs.
|
| https://statamic.dev/graphql
|
*/
'enabled' => env('STATAMIC_GRAPHQL_ENABLED', true),
'resources' => [
'collections' => true,
'navs' => true,
'taxonomies' => false,
'assets' => true,
'globals' => true,
'forms' => true,
'sites' => true,
'users' => false,
],
/*
|--------------------------------------------------------------------------
| Queries
|--------------------------------------------------------------------------
|
| Here you may list queries to be added to the Statamic schema.
|
| https://statamic.dev/graphql#custom-queries
|
*/
'queries' => [
//
],
/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
|
| Here you may list middleware to be added to the Statamic schema.
|
| https://statamic.dev/graphql#custom-middleware
|
*/
'middleware' => [
//
],
/*
|--------------------------------------------------------------------------
| Caching
|--------------------------------------------------------------------------
|
| By default, Statamic will cache each request until the specified
| expiry, or until content is changed. See the documentation for
| more details on how to customize your cache implementation.
|
| https://statamic.dev/graphql#caching
|
*/
'cache' => [
'expiry' => 60,
],
];
Thanks! Your GraphQL looks pretty much the same as mine.
I'm still unable to replicate, even using the Eloquent Driver. GraphQL queries are executing as expected... 🤔
Are you able to replicate the issue on a fresh Statamic site?
Are you able to try uninstalling the bitcraft/simple-seo
addon to see if that makes a difference at all?
Just following up, can you try to install the Simple SEO addon to see if that helps at all? It's the only difference I can see between our sites. It looks like a private addon so I can't test with it.
In the past I had a similar issue because the main navigation blueprint had no fields assigned to it. It had some in the navigation UI but not in the blueprint.
That's the reason for this issue. Have a nav with no blueprint fields. This is definitely a bug. A workaround for now is adding a hidden
field to your nav's blueprint.
Bug description
The GraphQL Api does not work in the latest Statamic Version. No query is possible, the explorer window is empty and there is also an error in the Docs.
How to reproduce
Query:
Result: {"errors":[{"message":"Cannot query field \"ping\" on type \"Query\".","locations":[{"line":2,"column":3}],"extensions":{"file":"\/home\/vagrant\/code\/xyz\/vendor\/webonyx\/graphql-php\/src\/Validator\/Rules\/FieldsOnCorrectType.php","line":43}}]}
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response