本文介绍了尝试在Roadrunner Server中使用laravel lighthouse-php时遇到间歇性错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • Roadrunner 1.8.1
  • Laravel:7.17.2
  • 灯塔:4.15.0

使用NGINX时,我的GraphQL API/架构没有问题.但是,当我切换到Roadrunner时,突然间断地收到诸如以下的错误:

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?

我确实启用了opcache,但是即使禁用了该功能,我仍然遇到此问题.

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

我已经运行了php artisan lighthouse:validate-schema,它是有效的我还运行了php artisan lighthouse:clear-cache,无济于事

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

推荐答案

我怀疑这可能与Lighthouse使用的模式缓存有关.如果您要部署具有新类型的架构但保留旧缓存,那么我怀疑您会看到这样的错误.

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.

解决方案是使用Artisan命令 lighthouse:clear-cache

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

这篇关于尝试在Roadrunner Server中使用laravel lighthouse-php时遇到间歇性错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 12:21