After installing the latest patch, I'm getting the following error:
String cannot represent a non string value
I understand that it is expected behaviour, but it breaks some queries since it worked before.
Looking into it!
Major fuck up on my part, apologies.
I accidentally cut it from the wrong (master) branch, which is the current state for the next major version 馃槄
I just released https://github.com/rebing/graphql-laravel/releases/tag/5.1.4 to remedy this
Thanks for the report, and sorry for the troubles!
Many thanks for the quick response.
@Artem-Schander btw, in fact I wasn't aware something would break with the next major version besides what is required due to the underlying graphql-php upgrade.
You wrote:
Define a query which accepts a type string argument
Run that query with an integer value for said arg
You don't happen to have stackrace left?
I would be curious if this happened in the graphql-laravel (bug) or graphql-php (upgrade, type strictness) library.
I could reproduce it over the week end.
But to be honest, I think the strict validation is the right way to deal with the request.
At least I understand GraphQL as a "strict type" query language.
Anyway, You'll get the stacktrace soon
Hi @mfn
Here is the stacktrace:
array:1 [
"errors" => array:1 [
0 => array:4 [
"message" => "Field "CO_Setup" argument "cms" requires type Int, found "51"."
"extensions" => array:1 [
"category" => "graphql"
]
"locations" => array:1 [
0 => array:2 [
"line" => 1
"column" => 33
]
]
"trace" => array:57 [
0 => array:3 [
"file" => "/var/www/html/vendor/webonyx/graphql-php/src/Validator/Rules/ValuesOfCorrectType.php"
"line" => 218
"call" => "GraphQL\Type\Definition\IntType::parseLiteral(instance of GraphQL\Language\AST\StringValueNode)"
]
1 => array:3 [
"file" => "/var/www/html/vendor/webonyx/graphql-php/src/Validator/Rules/ValuesOfCorrectType.php"
"line" => 169
"call" => "GraphQL\Validator\Rules\ValuesOfCorrectType::isValidScalar(instance of GraphQL\Validator\ValidationContext, instance of GraphQL\Language\AST\StringValueNode, 'CO_Setup')"
]
2 => array:3 [
"file" => "/var/www/html/vendor/webonyx/graphql-php/src/Language/Visitor.php"
"line" => 414
"call" => "GraphQL\Validator\Rules\ValuesOfCorrectType::GraphQL\Validator\Rules\{closure}(instance of GraphQL\Language\AST\StringValueNode, 'value', instance of GraphQL\Language\AST\ArgumentNode, array(8), array(7))"
]
3 => array:3 [
"file" => "/var/www/html/vendor/webonyx/graphql-php/src/Language/Visitor.php"
"line" => 470
"call" => "GraphQL\Language\Visitor::GraphQL\Language\{closure}(instance of GraphQL\Language\AST\StringValueNode, 'value', instance of GraphQL\Language\AST\ArgumentNode, array(8), array(7))"
]
4 => array:3 [
"file" => "/var/www/html/vendor/webonyx/graphql-php/src/Language/Visitor.php"
"line" => 277
"call" => "GraphQL\Language\Visitor::GraphQL\Language\{closure}(instance of GraphQL\Language\AST\StringValueNode, 'value', instance of GraphQL\Language\AST\ArgumentNode, array(8), array(7))"
]
5 => array:3 [
"file" => "/var/www/html/vendor/webonyx/graphql-php/src/Validator/DocumentValidator.php"
"line" => 224
"call" => "GraphQL\Language\Visitor::visit(instance of GraphQL\Language\AST\DocumentNode, array(2))"
]
6 => array:3 [
"file" => "/var/www/html/vendor/webonyx/graphql-php/src/Validator/DocumentValidator.php"
"line" => 116
"call" => "GraphQL\Validator\DocumentValidator::visitUsingRules(instance of GraphQL\Type\Schema, instance of GraphQL\Utils\TypeInfo, instance of GraphQL\Language\AST\DocumentNode, array(29))"
]
7 => array:3 [
"file" => "/var/www/html/vendor/webonyx/graphql-php/src/GraphQL.php"
"line" => 153
"call" => "GraphQL\Validator\DocumentValidator::validate(instance of GraphQL\Type\Schema, instance of GraphQL\Language\AST\DocumentNode, array(29))"
]
8 => array:3 [
"file" => "/var/www/html/vendor/webonyx/graphql-php/src/GraphQL.php"
"line" => 94
"call" => "GraphQL\GraphQL::promiseToExecute(instance of GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter, instance of GraphQL\Type\Schema, 'query FetchSetup {CO_Setup(cms: "51"){ meta { title version author email website copyright }auth { id email gender first_name last_name } }}', null, instance of App\Models\Base\User, null, null, null, null)"
]
9 => array:3 [
"file" => "/var/www/html/vendor/rebing/graphql-laravel/src/GraphQL.php"
"line" => 148
"call" => "GraphQL\GraphQL::executeQuery(instance of GraphQL\Type\Schema, 'query FetchSetup {CO_Setup(cms: "51"){ meta { title version author email website copyright }auth { id email gender first_name last_name } }}', null, instance of App\Models\Base\User, null, null, null)"
]
10 => array:3 [
"file" => "/var/www/html/vendor/rebing/graphql-laravel/src/GraphQL.php"
"line" => 126
"call" => "Rebing\GraphQL\GraphQL::queryAndReturnResult('query FetchSetup {CO_Setup(cms: "51"){ meta { title version author email website copyright }auth { id email gender first_name last_name } }}', null, array(3))"
]
11 => array:3 [
"file" => "/var/www/html/vendor/rebing/graphql-laravel/src/GraphQLController.php"
"line" => 73
"call" => "Rebing\GraphQL\GraphQL::query('query FetchSetup {CO_Setup(cms: "51"){ meta { title version author email website copyright }auth { id email gender first_name last_name } }}', null, array(3))"
]
12 => array:3 [
"file" => "/var/www/html/vendor/rebing/graphql-laravel/src/GraphQLController.php"
"line" => 48
"call" => "Rebing\GraphQL\GraphQLController::executeQuery('default', array(1))"
]
13 => array:1 [
"call" => "Rebing\GraphQL\GraphQLController::query(instance of Illuminate\Http\Request, 'default')"
]
14 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php"
"line" => 54
"function" => "call_user_func_array(array(2), array(2))"
]
15 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php"
"line" => 45
"call" => "Illuminate\Routing\Controller::callAction('query', array(2))"
]
16 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php"
"line" => 219
"call" => "Illuminate\Routing\ControllerDispatcher::dispatch(instance of Illuminate\Routing\Route, instance of Rebing\GraphQL\GraphQLController, 'query')"
]
17 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php"
"line" => 176
"call" => "Illuminate\Routing\Route::runController()"
]
18 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
"line" => 681
"call" => "Illuminate\Routing\Route::run()"
]
19 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 130
"call" => "Illuminate\Routing\Router::Illuminate\Routing\{closure}(instance of Illuminate\Http\Request)"
]
20 => array:3 [
"file" => "/var/www/html/app/Http/Middleware/AuthenticateMaybe.php"
"line" => 72
"call" => "Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}(instance of Illuminate\Http\Request)"
]
21 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 171
"call" => "App\Http\Middleware\AuthenticateMaybe::handle(instance of Illuminate\Http\Request, instance of Closure, 'api:members')"
]
22 => array:3 [
"file" => "/var/www/html/vendor/barryvdh/laravel-cors/src/HandleCors.php"
"line" => 36
"call" => "Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}(instance of Illuminate\Http\Request)"
]
23 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 171
"call" => "Barryvdh\Cors\HandleCors::handle(instance of Illuminate\Http\Request, instance of Closure)"
]
24 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 105
"call" => "Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}(instance of Illuminate\Http\Request)"
]
25 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
"line" => 683
"call" => "Illuminate\Pipeline\Pipeline::then(instance of Closure)"
]
26 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
"line" => 658
"call" => "Illuminate\Routing\Router::runRouteWithinStack(instance of Illuminate\Routing\Route, instance of Illuminate\Http\Request)"
]
27 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
"line" => 624
"call" => "Illuminate\Routing\Router::runRoute(instance of Illuminate\Http\Request, instance of Illuminate\Routing\Route)"
]
28 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
"line" => 613
"call" => "Illuminate\Routing\Router::dispatchToRoute(instance of Illuminate\Http\Request)"
]
29 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php"
"line" => 170
"call" => "Illuminate\Routing\Router::dispatch(instance of Illuminate\Http\Request)"
]
30 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 130
"call" => "Illuminate\Foundation\Http\Kernel::Illuminate\Foundation\Http\{closure}(instance of Illuminate\Http\Request)"
]
31 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php"
"line" => 21
"call" => "Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}(instance of Illuminate\Http\Request)"
]
32 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 171
"call" => "Illuminate\Foundation\Http\Middleware\TransformsRequest::handle(instance of Illuminate\Http\Request, instance of Closure)"
]
33 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php"
"line" => 21
"call" => "Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}(instance of Illuminate\Http\Request)"
]
34 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 171
"call" => "Illuminate\Foundation\Http\Middleware\TransformsRequest::handle(instance of Illuminate\Http\Request, instance of Closure)"
]
35 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php"
"line" => 27
"call" => "Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}(instance of Illuminate\Http\Request)"
]
36 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 171
"call" => "Illuminate\Foundation\Http\Middleware\ValidatePostSize::handle(instance of Illuminate\Http\Request, instance of Closure)"
]
37 => array:3 [
"file" => "/var/www/html/vendor/fideloper/proxy/src/TrustProxies.php"
"line" => 57
"call" => "Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}(instance of Illuminate\Http\Request)"
]
38 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 171
"call" => "Fideloper\Proxy\TrustProxies::handle(instance of Illuminate\Http\Request, instance of Closure)"
]
39 => array:3 [
"file" => "/var/www/html/vendor/barryvdh/laravel-cors/src/HandlePreflight.php"
"line" => 29
"call" => "Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}(instance of Illuminate\Http\Request)"
]
40 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 171
"call" => "Barryvdh\Cors\HandlePreflight::handle(instance of Illuminate\Http\Request, instance of Closure)"
]
41 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 105
"call" => "Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}(instance of Illuminate\Http\Request)"
]
42 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php"
"line" => 145
"call" => "Illuminate\Pipeline\Pipeline::then(instance of Closure)"
]
43 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php"
"line" => 110
"call" => "Illuminate\Foundation\Http\Kernel::sendRequestThroughRouter(instance of Illuminate\Http\Request)"
]
44 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php"
"line" => 469
"call" => "Illuminate\Foundation\Http\Kernel::handle(instance of Illuminate\Http\Request)"
]
45 => array:3 [
"file" => "/var/www/html/tests/Concerns/AttachJwtToken.php"
"line" => 75
"call" => "Illuminate\Foundation\Testing\TestCase::call('GET', '/graphql/default?query=query+FetchSetup {CO_Setup(cms: "51"){ meta { title version author email website copyright }auth { id email gender first_name last_name } }}', array(0), array(0), array(0), array(1), null)"
]
46 => array:3 [
"file" => "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php"
"line" => 259
"call" => "Tests\CityOffer\API\SetupQueryTest::call('GET', '/graphql/default?query=query+FetchSetup {CO_Setup(cms: "51"){ meta { title version author email website copyright }auth { id email gender first_name last_name } }}', array(0), array(0), array(0), array(1))"
]
47 => array:3 [
"file" => "/var/www/html/tests/CityOffer/API/SetupQueryTest.php"
"line" => 158
"call" => "Illuminate\Foundation\Testing\TestCase::get('/graphql/default?query=query+FetchSetup {CO_Setup(cms: "51"){ meta { title version author email website copyright }auth { id email gender first_name last_name } }}')"
]
48 => array:3 [
"file" => "/var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php"
"line" => 1415
"call" => "Tests\CityOffer\API\SetupQueryTest::fetching_a_setup_while_authenticated_via_get()"
]
49 => array:3 [
"file" => "/var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php"
"line" => 1035
"call" => "PHPUnit\Framework\TestCase::runTest()"
]
50 => array:3 [
"file" => "/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php"
"line" => 691
"call" => "PHPUnit\Framework\TestCase::runBare()"
]
51 => array:3 [
"file" => "/var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php"
"line" => 763
"call" => "PHPUnit\Framework\TestResult::run(instance of Tests\CityOffer\API\SetupQueryTest(1))"
]
52 => array:3 [
"file" => "/var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php"
"line" => 597
"call" => "PHPUnit\Framework\TestCase::run(instance of PHPUnit\Framework\TestResult(1))"
]
53 => array:3 [
"file" => "/var/www/html/vendor/phpunit/phpunit/src/TextUI/TestRunner.php"
"line" => 627
"call" => "PHPUnit\Framework\TestSuite::run(instance of PHPUnit\Framework\TestResult(1))"
]
54 => array:3 [
"file" => "/var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php"
"line" => 204
"call" => "PHPUnit\TextUI\TestRunner::doRun(instance of PHPUnit\Framework\TestSuite(1), array(64), array(0), true)"
]
55 => array:3 [
"file" => "/var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php"
"line" => 163
"call" => "PHPUnit\TextUI\Command::run(array(6), true)"
]
56 => array:3 [
"file" => "/var/www/html/vendor/phpunit/phpunit/phpunit"
"line" => 61
"call" => "PHPUnit\TextUI\Command::main()"
]
]
]
]
]
Now it's clearer to me, see https://github.com/webonyx/graphql-php/releases/tag/v14.0.0
BREAKING/BUGFIX: Strict coercion of scalar types (#278)
As I already said, it wasn't the intention to publish it in that form 馃槄 but my takeaway too that this library needs to point also the 3rd party breaking changes more clearly.
Thank you!
Most helpful comment
I could reproduce it over the week end.
But to be honest, I think the strict validation is the right way to deal with the request.
At least I understand GraphQL as a "strict type" query language.
Anyway, You'll get the stacktrace soon