Unable to resolve level 3 nested property in cell query

I’m trying to get a level 3 nested property (username) in my query, but it keeps coming back undefined. Is this a bug or am I messing up somewhere?

export const QUERY = gql`
  query FindDemosBySpaceId($id: String!) {
    space(id: $id) {
      demos {
        id
        spaceId
        userId
        user {
          username  <-- undefined
        }
        title
        url
        createdAt
      }
    }
  }
`

I can get the username if i make a level 2 nested query

export const QUERY = gql`
  query FindDemoById($id: String!) {
    demo: demo(id: $id) {
      id
      spaceId
      userId
      user {
        username  <-- Yes! has a value
      }
      title
      url
      createdAt
    }
  }
`

These are the relative SDLs. Note that PublicUser should be available on a Demo returned in a Space

type Space {
    id: String!
    user: PublicUser!
    userId: String!
    title: String!
    accepting: Boolean!
    demos: [Demo]!
    createdAt: DateTime!
  }

type Query {
    spaces: [Space!]! @requireAuth
    space(id: String!): Space @requireAuth
  }

type Demo {
    id: String!
    spaceId: String!
    user: PublicUser!
    userId: String!
    title: String!
    url: String!
    createdAt: DateTime!
  }

type Query {
    demos: [Demo!]! @requireAuth
    demo(id: String!): Demo @requireAuth
  }

type PublicUser {
    id: String!
    username: String!
  }

I don’t have an answer for you, but what does your service(s) look like? Have you checked what you get back from Prisma on the api side?

1 Like

@clairefro Prisma logging is your friend. Add the query level to both the emitters and levels in your lib/db.

Seeing your entire service would help as either your query isn’t including and making the join or your other resolvers don’t have a way you get a user from a demo.

1 Like

Sorry for wasting both of your breaths - turns out i had put my query in the wrong cell…

Anyway, TIL about query logging, thanks @dthyresson !