0

Here's the data:

enter image description here

Here's my code.

const { idArg, queryType, stringArg } = require('@nexus/schema')
const { getUserId } = require('../utils')

const Query = queryType({
  definition(t) {
    t.field('users', {
      type: 'User',
      resolve: (parent, args, ctx) => {
        return ctx.prisma.user.findMany()
      },
    })

module.exports = {
  Query,
}

I know the database has users in the table, but here's what I get when I run the following query in playground.

query {
  users{
    id
  }
}

{
  "data": null,
  "errors": [
    {
      "message": "Cannot return null for non-nullable field User.id.",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "users",
        "id"
      ]
    }
  ]
}

Thank you in advance for any help!

Darkmatter5
  • 1,189
  • 3
  • 12
  • 19

0 Answers0