GraphQLService execute on production
jimhaakman opened this issue · 2 comments
jimhaakman commented
I've encountered a problem when deploying CraftQL to production. And devmode is not active.
In markhuot\CraftQL\Services\GraphQLService.php
$debug = Craft::$app->config->getGeneral()->devMode ? DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::RETHROW_INTERNAL_EXCEPTIONS : null;
return GraphQL::executeQuery($schema, $input, null, null, $variables)->toArray($debug);
This throws an error as GraphQL::executeQuery->toArray expects $debug to be an integer.
Thank you very much.
AlexJezior commented
I am also experiencing this issue as well. The only way to have my application working is to set the ENVIRONMENT=dev
, otherwise it's rendered useless. Here's the stacktrace from my web.log:
2021-02-28 23:34:42 [-][1][-][error][TypeError] TypeError: Argument 1 passed to GraphQL\Executor\ExecutionResult::toArray() must be of the type int, null given, called in /var/www/craftsite.com/vendor/markhuot/craftql/src/Services/GraphQLService.php on line 132 and defined in /var/www/craftsite.com/vendor/webonyx/graphql-php/src/Executor/ExecutionResult.php:136
Stack trace:
#0 /var/www/craftsite.com/vendor/markhuot/craftql/src/Services/GraphQLService.php(132): GraphQL\Executor\ExecutionResult->toArray(NULL)
#1 /var/www/craftsite.com/vendor/markhuot/craftql/src/Controllers/ApiController.php(121): markhuot\CraftQL\Services\GraphQLService->execute(Object(GraphQL\Type\Schema), '{\n globa...', NULL)
#2 [internal function]: markhuot\CraftQL\Controllers\ApiController->actionIndex()
#3 /var/www/craftsite.com/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#4 /var/www/craftsite.com/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#5 /var/www/craftsite.com/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction('index', Array)
#6 /var/www/craftsite.com/vendor/yiisoft/yii2/base/Module.php(534): craft\web\Controller->runAction('index', Array)
#7 /var/www/craftsite.com/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module->runAction('craftql/api/ind...', Array)
#8 /var/www/craftsite.com/vendor/yiisoft/yii2/web/Application.php(104): craft\web\Application->runAction('craftql/api/ind...', Array)
#9 /var/www/craftsite.com/vendor/craftcms/cms/src/web/Application.php(259): yii\web\Application->handleRequest(Object(craft\web\Request))
#10 /var/www/craftsite.com/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest(Object(craft\web\Request))
#11 /var/www/craftsite.com/web/index.php(22): yii\base\Application->run()
#12 {main}
jimhaakman commented