- Issue created by @superfluousapostrophe
- π¦πΉAustria klausi π¦πΉ Vienna
Thanks for reporting!
I had the same problem in our installation because the 2 int properties were missing in our graphql entity server config:
query_depth: 20 query_complexity: 0
I wrote a custom update function to work around that:
/** * Set the missing query_depth and query_complexity values. */ function jobiqo_graphql_update_10103(): void { \Drupal::configFactory() ->getEditable('graphql.graphql_servers.jobiqo_schema') ->set('query_depth', 20) ->set('query_complexity', 0) ->save(); }
The int values were introduced in π 5.x fatal error creating new severs Active .
We have 2 options to solve this:
1. Implement constructor on the Server entity and always cast those 2 to int
2. Write an update function to update all graphql server entities that miss those 2 properties, where they are not int.I'm inclined to go with option 2, so that we don't have to maintain workaround code in the constructor.
- @klausi opened merge request.
-
klausi β
committed 21b5d37f on 5.x
fix(server): Fix error when query_depth or query_complexity is not...
-
klausi β
committed 21b5d37f on 5.x
- πΊπΈUnited States superfluousapostrophe
This is still happening for me with alpha3. I initially thought it was the same issue as before, but now it seems to only happen when I try to clear the views cache (or as part of a drush cr command)
For what it's worth, I am getting a success message for the views cache being cleared, but then the error prints out immediately after.
Here's my full stack trace:
TypeError: Cannot assign null to property Drupal\graphql\Entity\Server::$query_depth of type int in /app/docroot/core/lib/Drupal/Core/Entity/EntityBase.php on line 63 #0 /app/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(112): Drupal\Core\Entity\EntityBase->__construct(Array, 'graphql_server') #1 /app/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(418): Drupal\Core\Config\Entity\ConfigEntityBase->__construct(Array, 'graphql_server') #2 /app/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(186): Drupal\Core\Entity\EntityStorageBase->mapFromStorageRecords(Array) #3 /app/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(312): Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple(NULL) #4 /app/docroot/modules/contrib/graphql/src/RouteProvider.php(45): Drupal\Core\Entity\EntityStorageBase->loadMultiple() #5 [internal function]: Drupal\graphql\RouteProvider->routes() #6 /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(146): call_user_func(Array) #7 /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(210): Drupal\Core\Routing\RouteBuilder->rebuild() #8 /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(222): Drupal\Core\Routing\RouteBuilder->rebuildIfNeeded() #9 /app/docroot/core/lib/Drupal/Core/DrupalKernel.php(723): Drupal\Core\Routing\RouteBuilder->destruct() #10 /app/vendor/drush/drush/src/Boot/DrupalBoot8.php(314): Drupal\Core\DrupalKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse)) #11 [internal function]: Drush\Boot\DrupalBoot8->terminate() #12 {main} TypeError: Cannot assign null to property Drupal\graphql\Entity\Server::$query_depth of type int in Drupal\Core\Entity\EntityBase->__construct() (line 63 of /app/docroot/core/lib/Drupal/Core/Entity/EntityBase.php).