graphQL - type must be Output Type
Turns out I did not import another model I referenced. I had the following code :
myField : { type : Schema.Types.ObjectId, ref : 'myRef'}
And I was not importing 'myRef'
into the list of the mongoose models for which to use graphQL. Quite simple indeed; although the error message could probably be improved (what is this Output type ? What was undefined ?).
The error
Error: ... field type must be Output Type but got: undefined.
mean, you have a problem with GraphQLFieldConfig.
GraphQLFieldConfig need the type-field. If this field is missing or type-ref is bad (undefined etc.) this error appear.
class GraphQLObjectType { constructor(config: GraphQLObjectTypeConfig)}type GraphQLObjectTypeConfig = { name: string; interfaces?: GraphQLInterfacesThunk | Array<GraphQLInterfaceType>; fields: GraphQLFieldConfigMapThunk | GraphQLFieldConfigMap; isTypeOf?: (value: any, info?: GraphQLResolveInfo) => boolean; description?: ?string}type GraphQLInterfacesThunk = () => Array<GraphQLInterfaceType>;type GraphQLFieldConfigMapThunk = () => GraphQLFieldConfigMap;...type GraphQLFieldConfig = { type: GraphQLOutputType; args?: GraphQLFieldConfigArgumentMap; resolve?: GraphQLFieldResolveFn; deprecationReason?: string; description?: ?string;}