Cannot read property 'directives' of undefined at createFieldExecutionResolver
See original GitHub issueHi, it throws me the following error when trying to add directive resolve functions to the schema.
I have checked with forEachField and astNode is always undefined, is it my configuration or is it a bug?
const schema = new GraphQLSchema({
directives: [
new GraphQLDirective({
name: 'isAuth',
locations: [ DirectiveLocation.FIELD_DEFINITION, DirectiveLocation.FIELD ]
})
],
query: new GraphQLObjectType({
name: 'Query',
fields: {
user: {
type: new GraphQLObjectType({
name: 'User',
fields: () => ({
id: { type: GraphQLNonNull(GraphQLInt) },
email: { type: GraphQLNonNull(GraphQLString) }
})
}),
args: { id: { type: GraphQLInt } },
resolve: (parent, args, context, info) => {
return { id: 1, email: 'foo@gmail.com' };
}
}
}
})
});
const directiveResolvers = {
isAuth(next, source, args, context, info) {
throw Error('Ups!');
}
};
const { addDirectiveResolveFunctionsToSchema } = require('graphql-directive');
addDirectiveResolveFunctionsToSchema(schema, directiveResolvers);
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Cannot read property of undefined, directive *ngIf, Angular 8
you can try this options (added an answer bc couldn't be able to edit the comment):. Opt1: <div *ngIf="userData?
Read more >Schema Directives – GraphQL Tools
Everything you read below addresses some aspect of how a directive like @rename(to: ...) could be implemented. If that's not something you ...
Read more >Relay directives | Martin Zlámal
Relay supports many (mostly) client-only directives which help you to describe your ... TypeError: Cannot read properties of undefined (reading 'length').
Read more >Cannot read property 'subscribe' of undefined - ng-mocks
defaultMock in the case if the error has been caused by a mock component or a mock directive. Angular Material UI. If you...
Read more >Cannot Read Property “childNodes” Of Undefined In AngularJS
Ben Nadel demonstrates what may be causing a "TypeError: Cannot Read Property 'childNodes' Of Undefined " in your AngularJS application.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am facing the same problem while using graphql 0.13.2 with apollo-server-koa 1.3.4
Hi there,
have you figured out why yet?