markhuot / craftql

A drop-in GraphQL server for Craft CMS
Other
319 stars 53 forks source link

TypeError: Argument 1 passed to GraphQL\GraphQL::execute()... #17

Closed sjelfull closed 7 years ago

sjelfull commented 7 years ago

Not sure if i'm doing something wrong, but i'm getting a TypeError when I try to test CraftQL:


Exception 'TypeError' with message 'Argument 1 passed to GraphQL\GraphQL::execute() must be an instance of GraphQL\Schema, string given, called in /Users/fred/Projects/Craft3/craft3/vendor/markhuot/craftql/src/Services/GraphQLService.php on line 80'

in /Users/fred/Projects/Craft3/craft3/vendor/webonyx/graphql-php/src/GraphQL.php:27

Stack trace:
#0 /Users/fred/Projects/Craft3/craft3/vendor/markhuot/craftql/src/Services/GraphQLService.php(80): GraphQL\GraphQL::execute('{ helloWorld }', Array, NULL, NULL, Array)
#1 /Users/fred/Projects/Craft3/craft3/vendor/markhuot/craftql/src/Console/ToolsController.php(73): markhuot\CraftQL\Services\GraphQLService->execute('{ helloWorld }', Array)
#2 /Users/fred/Projects/Craft3/craft3/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): markhuot\CraftQL\Console\ToolsController->markhuot\CraftQL\Console\{closure}()
#3 /Users/fred/Projects/Craft3/craft3/vendor/react/http/src/HttpBodyStream.php(169): Evenement\EventEmitter->emit('end')
#4 /Users/fred/Projects/Craft3/craft3/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): React\Http\HttpBodyStream->handleEnd()
#5 /Users/fred/Projects/Craft3/craft3/vendor/react/http/src/LengthLimitedStream.php(81): Evenement\EventEmitter->emit('end')
#6 /Users/fred/Projects/Craft3/craft3/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): React\Http\LengthLimitedStream->handleData('{"query": "{ he...')
#7 /Users/fred/Projects/Craft3/craft3/vendor/react/http/src/CloseProtectionStream.php(85): Evenement\EventEmitter->emit('data', Array)
#8 /Users/fred/Projects/Craft3/craft3/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): React\Http\CloseProtectionStream->handleData('{"query": "{ he...')
#9 /Users/fred/Projects/Craft3/craft3/vendor/react/http/src/Server.php(178): Evenement\EventEmitter->emit('data', Array)
#10 /Users/fred/Projects/Craft3/craft3/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): React\Http\Server->React\Http\{closure}(Object(React\Http\ServerRequest), '{"query": "{ he...')
#11 /Users/fred/Projects/Craft3/craft3/vendor/react/http/src/RequestHeaderParser.php(61): Evenement\EventEmitter->emit('headers', Array)
#12 /Users/fred/Projects/Craft3/craft3/vendor/react/http/src/RequestHeaderParser.php(49): React\Http\RequestHeaderParser->parseAndEmitRequest(127)
#13 /Users/fred/Projects/Craft3/craft3/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): React\Http\RequestHeaderParser->feed('POST / HTTP/1.1...')
#14 /Users/fred/Projects/Craft3/craft3/vendor/react/stream/src/Util.php(71): Evenement\EventEmitter->emit('data', Array)
#15 /Users/fred/Projects/Craft3/craft3/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): React\Stream\Util::React\Stream\{closure}('POST / HTTP/1.1...')
#16 /Users/fred/Projects/Craft3/craft3/vendor/react/stream/src/DuplexResourceStream.php(186): Evenement\EventEmitter->emit('data', Array)
#17 [internal function]: React\Stream\DuplexResourceStream->handleData(Resource id #246, Object(React\EventLoop\StreamSelectLoop))
#18 /Users/fred/Projects/Craft3/craft3/vendor/react/event-loop/src/StreamSelectLoop.php(236): call_user_func(Array, Resource id #246, Object(React\EventLoop\StreamSelectLoop))
#19 /Users/fred/Projects/Craft3/craft3/vendor/react/event-loop/src/StreamSelectLoop.php(205): React\EventLoop\StreamSelectLoop->waitForStreamActivity(NULL)
#20 /Users/fred/Projects/Craft3/craft3/vendor/markhuot/craftql/src/Console/ToolsController.php(97): React\EventLoop\StreamSelectLoop->run()
#21 [internal function]: markhuot\CraftQL\Console\ToolsController->actionServe()
#22 /Users/fred/Projects/Craft3/craft3/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#23 /Users/fred/Projects/Craft3/craft3/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\InlineAction->runWithParams(Array)
#24 /Users/fred/Projects/Craft3/craft3/vendor/yiisoft/yii2/console/Controller.php(128): yii\base\Controller->runAction('serve', Array)
#25 /Users/fred/Projects/Craft3/craft3/vendor/yiisoft/yii2/base/Module.php(523): yii\console\Controller->runAction('serve', Array)
#26 /Users/fred/Projects/Craft3/craft3/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('craftql/tools/s...', Array)
#27 /Users/fred/Projects/Craft3/craft3/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('craftql/tools/s...', Array)
#28 /Users/fred/Projects/Craft3/craft3/vendor/yiisoft/yii2/base/Application.php(380): yii\console\Application->handleRequest(Object(craft\console\Request))
#29 /Users/fred/Projects/Craft3/craft3/craft(20): yii\base\Application->run()
#30 {main}```
markhuot commented 7 years ago

Thanks for the report @sjelfull. Am I reading this correctly that you're using the craft craftql/tools/serve method? If so this may be a regression in the code. I'll get a fix applied.

sjelfull commented 7 years ago

Yep, that's correct. Let me know if I should dig into it more.

— Fred Carlsen +47 476 51 126 Skype: sjelfull www.superbig.co

On 7 Sep 2017, 14:58 +0200, Mark Huot notifications@github.com, wrote:

Thanks for the report @sjelfull. Am I reading this correctly that you're using the craft craftql/tools/serve method? If so this may be a regression in the code. I'll get a fix applied. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

markhuot commented 7 years ago

Thanks for the offer. @sjelfull! However, this should be fixed up now. I had refactored some things and missed an update in the CLI controller. A composer update should get you 1.0.0-beta.13, which contains the fix.