Experiencing intermittent errors when trying to use laravel lighthouse-php with Roadrunner Server

Viewed 1113
  • Roadrunner 1.8.1
  • Laravel: 7.17.2
  • Lighthouse: 4.15.0

When using NGINX, I have no issues with my GraphQL API/Schema. However, when I switch to Roadrunner, I suddenly, intermittently get errors like:

"message": "Lighthouse failed while trying to load a type: MyType\n\nMake sure the type is present in your schema definition.\n",
    "exception": "Nuwave\\Lighthouse\\Exceptions\\DefinitionException",
    "file": "/var/www/wright/ams/vendor/nuwave/lighthouse/src/Schema/TypeRegistry.php",
    "line": 94

Has anyone else experienced this and found a solution?

I did have opcache enabled, but even with that disabled, I'm still experiencing this issue.

I've run php artisan lighthouse:validate-schema, and it is valid I've also run php artisan lighthouse:clear-cache, to no avail

1 Answers

I suspect this might be to do with the schema caching that Lighthouse uses. If you're deploying a schema with a new type but retaining an old cache then I would suspect you would see an error like this.

The solution would be to clear the lighthouse cache using the Artisan command lighthouse:clear-cache

Related