• 1000 bundle.esm. js: 69 POST
http://127.0.1.4/api 500 (внутренняя ошибка сервера)
Я получаю эту ошибку, когда открываю страницу игровой площадки маяка, и у меня даже нет шанса для написания запросов.
Вот мой файл конфигурации маяка, я только что изменил часть route
на api
, а также эту часть 'enable' => env('LIGHTHOUSE_CACHE_ENABLE', false)
:
<?php
return [
'route' => [
'uri' => '/api',
'name' => 'api',
'middleware' => [
\Nuwave\Lighthouse\Support\Http\Middleware\AcceptJson::class,
\Nuwave\Lighthouse\Support\Http\Middleware\AttemptAuthentication::class,
],
],
'guard' => null,
'schema' => [
'register' => base_path('graphql/schema.graphql'),
],
'cache' => [
'enable' => env('LIGHTHOUSE_CACHE_ENABLE', false),
'key' => env('LIGHTHOUSE_CACHE_KEY', 'lighthouse-schema'),
'ttl' => env('LIGHTHOUSE_CACHE_TTL', null),
],
'namespaces' => [
'models' => 'App\\Models',
'queries' => 'App\\GraphQL\\Queries',
'mutations' => 'App\\GraphQL\\Mutations',
'subscriptions' => 'App\\GraphQL\\Subscriptions',
'interfaces' => 'App\\GraphQL\\Interfaces',
'unions' => 'App\\GraphQL\\Unions',
'scalars' => 'App\\GraphQL\\Scalars',
'directives' => ['App\\GraphQL\\Directives'],
],
'security' => [
'max_query_complexity' => \GraphQL\Validator\Rules\QueryComplexity::DISABLED,
'max_query_depth' => \GraphQL\Validator\Rules\QueryDepth::DISABLED,
'disable_introspection' => \GraphQL\Validator\Rules\DisableIntrospection::DISABLED,
],
'pagination' => [
'default_count' => 10,
'max_count' => null,
],
'pagination_amount_argument' => 'first',
'orderBy' => 'field',
'debug' => \GraphQL\Error\Debug::INCLUDE_DEBUG_MESSAGE | \GraphQL\Error\Debug::INCLUDE_TRACE,
'error_handlers' => [
\Nuwave\Lighthouse\Execution\ExtensionErrorHandler::class,
\Nuwave\Lighthouse\Execution\ReportingErrorHandler::class,
],
'global_id_field' => 'id',
'batched_queries' => true,
'transactional_mutations' => true,
'batchload_relations' => true,
'subscriptions' => [
'queue_broadcasts' => env('LIGHTHOUSE_QUEUE_BROADCASTS', true),
'broadcasts_queue_name' => env('LIGHTHOUSE_BROADCASTS_QUEUE_NAME', null),
'storage' => env('LIGHTHOUSE_SUBSCRIPTION_STORAGE', 'redis'),
'storage_ttl' => env('LIGHTHOUSE_SUBSCRIPTION_STORAGE_TTL', null),
'broadcaster' => env('LIGHTHOUSE_BROADCASTER', 'pusher'),
'broadcasters' => [
'log' => [
'driver' => 'log',
],
'pusher' => [
'driver' => 'pusher',
'routes' => \Nuwave\Lighthouse\Subscriptions\SubscriptionRouter::class.'@pusher',
'connection' => 'pusher',
],
],
],
'defer' => [
'max_nested_fields' => 0,
'max_execution_ms' => 0,
],
];
А вот и мой Файл конфигурации CORS, я только что изменил часть paths
на api
:
<?php
return [
'paths' => ['api/*'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];
Вот файл схемы graphql:
"A date string with format `Y-m-d`, e.g. `2011-05-23`."
scalar Date @scalar(class: "Nuwave\\Lighthouse\\Schema\\Types\\Scalars\\Date")
"A datetime string with format `Y-m-d H:i:s`, e.g. `2018-05-23 13:43:32`."
scalar DateTime @scalar(class: "Nuwave\\Lighthouse\\Schema\\Types\\Scalars\\DateTime")
"A datetime and timezone string in ISO 8601 format `Y-m-dTH:i:sO`, e.g. `2020-04-20T13:53:12+02:00`."
scalar DateTimeTz @scalar(class: "Nuwave\\Lighthouse\\Schema\\Types\\Scalars\\DateTimeTz")
type Query {
fields(input: ListInput @spread): [Field]
field(id: ID! @eq): Field @find(model: "App\\Field")
}
type Mutation {
createField(
name_en: String! @rules(apply: ["required"])
name_fa: String
description: String
img_url: String
): Field @create(model: "App\\Field")
updateField(
id: ID! @rules(apply: ["required", "int"])
name_en: String @rules(apply: ["required"])
name_fa: String
description: String
img_url: String
): Field @update(model: "App\\Field")
deleteField(
id: ID! @rules(apply: ["required", "int"])
): Field @delete(model: "App\\Field")
}
type Field {
id: ID!
name_en: String!
name_fa: String!
description: String!
img_url: String!
created_at: DateTime!
updated_at: DateTime!
subFields: [SubField] @hasMany
}
input ListInput {
page: Int @rules(apply: ["int"])
limit: Int @rules(apply: ["int"])
q: String @rules(apply: ["string", "max:191"])
}
Я действительно понятия не имею, в чем проблема. Надеюсь, ты поможешь мне с этим.