Hey, I'm trying to solve `Error: Cannot return nul...
# orm-help
m
Hey, I'm trying to solve
Error: Cannot return null for non-nullable field Log.id.
. Googled already to find an answer but I can't seem to find a solution. Does somebody have an idea what it could be? This is my code: Query resolver:
Copy code
const Query = {
  async logs(parent, args, ctx, info) {
    const logs = await ctx.db.query.logs();

    return logs;
  }
};

module.exports = Query;
schema.graphql
Copy code
input LogInput {
  name: String!
  date: DateTime!
}

type Mutation {
  createLog(data: LogInput): Log!
}

type Query {
  logs: Log
}
datamodel:
Copy code
type Log {
  id: ID! @id
  name: String!
  date: DateTime!

}
Update: When I edit my query to return the first item of the array, I do get results, but when I just return the whole array I still get that error.
Copy code
const Query = {
  async logs(parent, args, ctx, info) {
    // console.log(" await ctx.db.query.logs()", ctx.db.query.logs());
    const logs = await ctx.db.query.logs();

    console.log("LOGS", logs[0]);
    // console.log(ctx.db);
    return logs[0];
  }
};
Also used the playground on the prisma database side and that seems to be working fine aswell.