After upgrading our application framework from Laravel 12 to Laravel 13, using Redis as the backing store for Lighthouse's query cache query_cache.mode = 'store', requests fail with the following type error:
{
"errors": [
{
"message": "Internal server error",
"extensions": {
"debugMessage": "Nuwave\\Lighthouse\\Cache\\QueryCache::fromStoreOrParse(): Return value must be of type GraphQL\\Language\\AST\\DocumentNode, __PHP_Incomplete_Class returned",
"file": "/var/www/html/vendor/nuwave/lighthouse/src/Cache/QueryCache.php",
"line": 84,
"trace": [
{
"file": "/var/www/html/vendor/nuwave/lighthouse/src/Cache/QueryCache.php",
"line": 72,
"call": "Nuwave\\Lighthouse\\Cache\\QueryCache::fromStoreOrParse()"
},
{
"file": "/var/www/html/vendor/nuwave/lighthouse/src/GraphQL.php",
"line": 287,
"call": "Nuwave\\Lighthouse\\Cache\\QueryCache::fromCacheOrParse()"
},
....
Steps to reproduce
- Upgrade Laravel application to Laravel 13.
- Set up a dedicated cache store in config/cache.php enabling serializable_classes:
'graphql_cache' => array_merge([
'driver' => env('CACHE_STORE', 'database'),
'serializable_classes' => true,
], env('CACHE_STORE') === 'database' ? [
'table' => 'cache',
'connection' => null,
] : []),
- Ensure the underlying redis driver configuration in config/cache.php also includes 'serializable_classes' => true:
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'default'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
'serializable_classes' => true,
],
- Configure Lighthouse to use the store in config/lighthouse.php
'query_cache' => [
'enable' => true,
'store' => 'graphql_cache',
'mode' => 'store',
],
- Execute any valid GraphQL query against the application.
- Trigger a second request with the same query so it hits the Redis cache store.
Expected behavior / Solution
Expected behavior: Lighthouse should successfully retrieve and unserialize the cached GraphQL\Language\AST\DocumentNode instance from the Redis store without throwing a type error.
PHP Version 8.4.23
Lighthouse Version 6.66.0
After upgrading our application framework from Laravel 12 to Laravel 13, using Redis as the backing store for Lighthouse's query cache
query_cache.mode = 'store', requests fail with the following type error:{ "errors": [ { "message": "Internal server error", "extensions": { "debugMessage": "Nuwave\\Lighthouse\\Cache\\QueryCache::fromStoreOrParse(): Return value must be of type GraphQL\\Language\\AST\\DocumentNode, __PHP_Incomplete_Class returned", "file": "/var/www/html/vendor/nuwave/lighthouse/src/Cache/QueryCache.php", "line": 84, "trace": [ { "file": "/var/www/html/vendor/nuwave/lighthouse/src/Cache/QueryCache.php", "line": 72, "call": "Nuwave\\Lighthouse\\Cache\\QueryCache::fromStoreOrParse()" }, { "file": "/var/www/html/vendor/nuwave/lighthouse/src/GraphQL.php", "line": 287, "call": "Nuwave\\Lighthouse\\Cache\\QueryCache::fromCacheOrParse()" }, ....Steps to reproduce
Expected behavior / Solution
Expected behavior: Lighthouse should successfully retrieve and unserialize the cached
GraphQL\Language\AST\DocumentNodeinstance from the Redis store without throwing a type error.PHP Version 8.4.23
Lighthouse Version 6.66.0