GraphQL Expected Iterable, but did not find one for field xxx.yyy : <p>I'm currently trying GraphQL with NodeJS and I don't know, why this error occurs with the following query:</p>

<pre><code>{
  library{
    name,
    user {
      name
      email
    }
  }
}
</code></pre>

<p>I am not sure if the <code>type</code> of my <code>resolveLibrary</code> is right, because at any example I had a look at they used <code>new GraphQL.GraphQLList()</code>, but in my case I really want to return a single user object, not an array of users.</p>

<p>My code:</p>

<pre><code>const GraphQL = require('graphql');
const DB = require('../database/db');
const user = require('./user').type;

const library = new GraphQL.GraphQLObjectType({
    name: 'library',
    description: `This represents a user's library`,
    fields: () =&gt; {
        return {
            name: {
                type: GraphQL.GraphQLString,
                resolve(library) {
                    return library.name;
                }
            },
            user: {
                type: user,
                resolve(library) {
                    console.log(library.user);
                    return library.user
                }
            }
        }
    }
});

const resolveLibrary = {
    type: library,
    resolve(root) {
        return {
            name: 'My fancy library',
            user: {
                name: 'User name',
                email: {
                    email: 'test@123.de'
                }
           }
        }
    }
}

module.exports = resolveLibrary;
</code></pre>

<p>Error:</p>

<pre><code>Error: Expected Iterable, but did not find one for field library.user.
</code></pre>

<p>So my <code>library</code> schema provides a <code>user</code> field which returns the right data (the console.log is called).</p>
