Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Smsma's avatar
Level 2

"folklore/graphql" with laravel

this error happen when I use "folklore/graphql"

"message": "Type default_schema not found.",
  "exception": "Folklore\GraphQL\Exception\SchemaNotFound",
  "file": "D:\dev\htdocs\pipzn\vendor\folklore\graphql\src\Folklore\GraphQL\GraphQL.php",
  "line": 43,
  "trace": [
    {
      "file": "D:\dev\htdocs\pipzn\vendor\folklore\graphql\src\Folklore\GraphQL\GraphQL.php",
      "line": 168,
      "function": "schema",
      "class": "Folklore\GraphQL\GraphQL",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\folklore\graphql\src\Folklore\GraphQL\GraphQL.php",
      "line": 141,
      "function": "queryAndReturnResult",
      "class": "Folklore\GraphQL\GraphQL",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\folklore\graphql\src\Folklore\GraphQL\GraphQLController.php",
      "line": 103,
      "function": "query",
      "class": "Folklore\GraphQL\GraphQL",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\folklore\graphql\src\Folklore\GraphQL\GraphQLController.php",
      "line": 60,
      "function": "executeQuery",
      "class": "Folklore\GraphQL\GraphQLController",
      "type": "->"
    },
    {
      "function": "query",
      "class": "Folklore\GraphQL\GraphQLController",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Controller.php",
      "line": 54,
      "function": "call_user_func_array"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php",
      "line": 45,
      "function": "callAction",
      "class": "Illuminate\Routing\Controller",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Route.php",
      "line": 212,
      "function": "dispatch",
      "class": "Illuminate\Routing\ControllerDispatcher",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Route.php",
      "line": 169,
      "function": "runController",
      "class": "Illuminate\Routing\Route",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
      "line": 658,
      "function": "run",
      "class": "Illuminate\Routing\Route",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
      "line": 30,
      "function": "Illuminate\Routing\{closure}",
      "class": "Illuminate\Routing\Router",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
      "line": 102,
      "function": "Illuminate\Routing\{closure}",
      "class": "Illuminate\Routing\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
      "line": 660,
      "function": "then",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
      "line": 635,
      "function": "runRouteWithinStack",
      "class": "Illuminate\Routing\Router",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
      "line": 601,
      "function": "runRoute",
      "class": "Illuminate\Routing\Router",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
      "line": 590,
      "function": "dispatchToRoute",
      "class": "Illuminate\Routing\Router",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
      "line": 176,
      "function": "dispatch",
      "class": "Illuminate\Routing\Router",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
      "line": 30,
      "function": "Illuminate\Foundation\Http\{closure}",
      "class": "Illuminate\Foundation\Http\Kernel",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\fideloper\proxy\src\TrustProxies.php",
      "line": 56,
      "function": "Illuminate\Routing\{closure}",
      "class": "Illuminate\Routing\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
      "line": 149,
      "function": "handle",
      "class": "Fideloper\Proxy\TrustProxies",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
      "line": 53,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",
      "line": 30,
      "function": "Illuminate\Routing\{closure}",
      "class": "Illuminate\Routing\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
      "line": 149,
      "function": "handle",
      "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
      "line": 53,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",
      "line": 30,
      "function": "Illuminate\Routing\{closure}",
      "class": "Illuminate\Routing\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
      "line": 149,
      "function": "handle",
      "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
      "line": 53,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php",
      "line": 27,
      "function": "Illuminate\Routing\{closure}",
      "class": "Illuminate\Routing\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
      "line": 149,
      "function": "handle",
      "class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
      "line": 53,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php",
      "line": 46,
      "function": "Illuminate\Routing\{closure}",
      "class": "Illuminate\Routing\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
      "line": 149,
      "function": "handle",
      "class": "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",
      "line": 53,
      "function": "Illuminate\Pipeline\{closure}",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
      "line": 102,
      "function": "Illuminate\Routing\{closure}",
      "class": "Illuminate\Routing\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
      "line": 151,
      "function": "then",
      "class": "Illuminate\Pipeline\Pipeline",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
      "line": 116,
      "function": "sendRequestThroughRouter",
      "class": "Illuminate\Foundation\Http\Kernel",
      "type": "->"
    },
    {
      "file": "D:\dev\htdocs\pipzn\index.php",
      "line": 55,
      "function": "handle",
      "class": "Illuminate\Foundation\Http\Kernel",
      "type": "->"
    }
  ]
}
<?php


return [

    /*
     * The prefix for routes
     */
    'prefix' => 'graphql',

    /*
     * The domain for routes
     */
    'domain' => null,

    /*
     * The routes to make GraphQL request. Either a string that will apply
     * to both query and mutation or an array containing the key 'query' and/or
     * 'mutation' with the according Route
     *
     * Example:
     *
     * Same route for both query and mutation
     *
     * 'routes' => [
     *     'query' => 'query/{graphql_schema?}',
     *     'mutation' => 'mutation/{graphql_schema?}',
     *      mutation' => 'graphiql'
     * ]
     *
     * you can also disable routes by setting routes to null
     *
     * 'routes' => null,
     */
    'routes' => '{graphql_schema?}',

    /*
     * The controller to use in GraphQL requests. Either a string that will apply
     * to both query and mutation or an array containing the key 'query' and/or
     * 'mutation' with the according Controller and method
     *
     * Example:
     *
     * 'controllers' => [
     *     'query' => '\Folklore\GraphQL\GraphQLController@query',
     *     'mutation' => '\Folklore\GraphQL\GraphQLController@mutation'
     * ]
     */
    'controllers' => \Folklore\GraphQL\GraphQLController::class.'@query',

    /*
     * The name of the input variable that contain variables when you query the
     * endpoint. Most libraries use "variables", you can change it here in case you need it.
     * In previous versions, the default used to be "params"
     */
    'variables_input_name' => 'variables',

    /*
     * Any middleware for the 'graphql' route group
     */
    'middleware' => [],

    /**
     * Any middleware for a specific 'graphql' schema
     */
    'middleware_schema' => [
        'default' => [],
    ],

    /*
     * Any headers that will be added to the response returned by the default controller
     */
    'headers' => [],

    /*
     * Any JSON encoding options when returning a response from the default controller
     * See http://php.net/manual/function.json-encode.php for the full list of options
     */
    'json_encoding_options' => 0,

    /*
     * Config for GraphiQL (see (https://github.com/graphql/graphiql).
     * To disable GraphiQL, set this to null
     */
    'graphiql' => [
        'routes' => '/graphiql/{graphql_schema?}',
        'controller' => \Folklore\GraphQL\GraphQLController::class.'@graphiql',
        'middleware' => [],
        'view' => 'graphql::graphiql',
        'composer' => \Folklore\GraphQL\View\GraphiQLComposer::class,
    ],

    /*
     * The name of the default schema used when no arguments are provided
     * to GraphQL::schema() or when the route is used without the graphql_schema
     * parameter
     */
    'schema' => 'default',

    /*
     * The schemas for query and/or mutation. It expects an array to provide
     * both the 'query' fields and the 'mutation' fields. You can also
     * provide an GraphQL\Type\Schema object directly.
     *
     * Example:
     *
     * 'schemas' => [
     *     'default' => new Schema($config)
     * ]
     *
     * or
     *
     * 'schemas' => [
     *     'default' => [
     *         'query' => [
     *              'users' => 'App\GraphQL\Query\UsersQuery'
     *          ],
     *          'mutation' => [
     *
     *          ]
     *     ]
     * ]
     */
    'schema' => 'default_schema',

    'schemas' => [
        'default' => [
            'query' => [
                // 'user' => App\GraphQL\Query\UserQuery::class,
                // 'post' => App\GraphQL\Query\PostQuery::class,
                // 'story' => App\GraphQL\Query\StoryQuery::class
            ],
            'mutation' => [
                // 'createUser' => App\GraphQL\Mutation\CreateUserMutation::class,
                // 'updateUser' => App\GraphQL\Mutation\UpdateUserMutation::class,
                // 'createPost' => App\GraphQL\Mutation\CreatePostMutation::class,
                // 'updatePost' => App\GraphQL\Mutation\UpdatePostMutation::class,
                // 'createStory' => App\GraphQL\Mutation\CreateStoryMutation::class,
                // 'updateStory' => App\GraphQL\Mutation\UpdateStoryMutation::class,
            ]
        ]
    ],

    /*
     * Additional resolvers which can also be used with shorthand building of the schema
     * using \GraphQL\Utils::BuildSchema feature
     *
     * Example:
     *
     * 'resolvers' => [
     *     'default' => [
     *         'echo' => function ($root, $args, $context) {
     *              return 'Echo: ' . $args['message'];
     *          },
     *     ],
     * ],
     */
    'resolvers' => [
        'default' => [
        ],
    ],

    /*
     * Overrides the default field resolver
     * Useful to setup default loading of eager relationships
     *
     * Example:
     *
     * 'defaultFieldResolver' => function ($root, $args, $context, $info) {
     *     // take a look at the defaultFieldResolver in
     *     // https://github.com/webonyx/graphql-php/blob/master/src/Executor/Executor.php
     * },
     */
    'defaultFieldResolver' => null,

    /*
     * The types available in the application. You can access them from the
     * facade like this: GraphQL::type('user')
     *
     * Example:
     *
     * 'types' => [
     *     'user' => 'App\GraphQL\Type\UserType'
     * ]
     *
     * or without specifying a key (it will use the ->name property of your type)
     *
     * 'types' =>
     *     'App\GraphQL\Type\UserType'
     * ]
     */
    'types' => [
        App\GraphQL\Type\UserType::class,
        App\GraphQL\Type\PostType::class,
        App\GraphQL\Type\StoryType::class
   ],

    /*
     * This callable will receive all the Exception objects that are caught by GraphQL.
     * The method should return an array representing the error.
     *
     * Typically:
     *
     * [
     *     'message' => '',
     *     'locations' => []
     * ]
     */
    'error_formatter' => [\Folklore\GraphQL\GraphQL::class, 'formatError'],

    /*
     * Options to limit the query complexity and depth. See the doc
     * @ https://github.com/webonyx/graphql-php#security
     * for details. Disabled by default.
     */
    'security' => [
        'query_max_complexity' => null,
        'query_max_depth' => null,
        'disable_introspection' => false
    ]
];

0 likes
0 replies

Please or to participate in this conversation.