Lighthouse: Node [Blah] can only have one directive of type [Nuwave\\Lighthouse\\Support\\Contracts\\FieldResolver] but found []

Created on 26 May 2020  路  5Comments  路  Source: nuwave/lighthouse

https://github.com/nuwave/lighthouse/blob/d035d7a8e0bb0c4593c223ad1ccc36e4d5faa2b2/src/Schema/Factories/DirectiveFactory.php#L199

It seems this line isn't working I get the following error message:

Node [Blah] can only have one directive of type [Nuwave\Lighthouse\Support\Contracts\FieldResolver] but found []

It should be showing the resolvers that it finds rather than an empty array?

bug

All 5 comments

(BTW I'm trying to use two resolvers but you can't do that with lighthouse, I'm not sure of the best way around this)

I'd like to use the @create resolver, _and_ then do something with the output before returning (log the user in).

Dunno why your error comes, but for your described task you can create a custom FieldMiddleware directive, mentioned here in docs

Take a look at some builtin directives, that implement defined contract (e.g. CanDirective). You can execute your custom code before or after field resolving.

And I mean this is not possible at all, to use multiple resolvers in graphql? It makes to me no sense... therefore there are middleware directives

Hey, I'll take a look at the FieldMiddleware, thanks!

The bug is an odd one because it should list the classes that are found but doesn't!

Thanks for the report, fixed the message.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eriktisme picture eriktisme  路  4Comments

spawnia picture spawnia  路  4Comments

spawnia picture spawnia  路  4Comments

Leuloch picture Leuloch  路  3Comments

spawnia picture spawnia  路  3Comments