Replies: 1 comment 1 reply
-
|
The context is not the first argument of graphql-js resolvers, it's the 3rd argument. const resolvers = {
Query: {
- server: (context: Context): Server => {
+ server: (_parent, _args, context: Context): Server => {
logDebug(context.env, 'Hit resolver');
return { say: {hello: "Hello, world!" } };
}
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Here is a simple example that illustrates my problem. I have setup graphql-http as follows:
where
Lastly, my resolver is defined as:
Now whenever I query my resolver
serverusingI get the following:
I don't really understand this error, because
envis definitely not undefined. Unless it somehow thinks it's supposed to be part of the schema, but I'm just accessing a passed in parameter. If I remove thelogDebugline which removes accessingcontext.envthe query works as expected.Any help would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions