-
-
Notifications
You must be signed in to change notification settings - Fork 466
Description
Laravel Version: 6.18.25
Lighthouse version: ^4.15
PHP version: 7.4.7
Laravel configuration: Default configuration
Lighthouse configuration: Default configuration
I created my own mutation resolver, and I used the arguments to my function like $rootValue, array $args, GraphQLContext $context = null, ResolveInfo $resolveInfo. I forgot to import the ResolveInfo class. Thus, the compiler thought the class resides in App\GraphQL\Mutations namespace. Which it doesn't.
So, when I executed the mutation, it showed the error like below.

I ran dd(get_class($error), class_implements($error), get_class($error->getPrevious()), class_implements($error->getPrevious())); in Nuwave\Lighthouse\Execution\ReportingErrorHandler::20 and found
So, I changed $error->getPrevious() to $error in Nuwave\Lighthouse\Execution\ReportingErrorHandler::25 and found the following which I think should be the actual behavior.

- In my server,
type Mutation {
jwtLogin(input: LoginInput @spread): AuthPayload! @field(resolver: "AuthMutation@jwtLogin")
}
- In my mutation
<?php
namespace App\GraphQL\Mutations;
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;
class AuthMutation
{
public function jwtLogin ($rootValue, array $args, GraphQLContext $context = null, ResolveInfo $resolveInfo) {
// login goes here
}
}- In my client
mutation {
jwtLogin(input: {
username:"admin@example.com"
password: "12345"
}) {
access_token
refresh_token
expires_in
token_type
user{
id
name
email
}
}
}
