Query doesn't return relevant data

This is how my schema.prisma file looks like.

model Artist {
  id Int @id @default(autoincrement())

  name  String
  slug  String
  image String

  songs Song[]
  comments Comment[]

model Song {
  id       Int    @id @default(autoincrement())
  artist   Artist @relation(fields: [artistId], references: [id])
  artistId Int

  title String
  image String
  posts Post[]

model Post {
  id     Int   @id @default(autoincrement())
  song   Song? @relation(fields: [songId], references: [id])
  songId Int?

  date   DateTime
  type   String // VIDEO | IMAGE | TEXT
  action String // ADDED | UPDATED

  content String
  comments Comment[]

model Comment {
  id      Int   @id @default(autoincrement())
  content String
  post    Post @relation(fields: [postId], references: [id])
  postId  Int
  artist Artist @relation(fields: [artistId], references: [id])
  artistId Int

An artist can leave comment on a post (which actually belongs to a song of another ARTIST).
CREATE_COMMENT_MUTATION works properly and I can see comments are added.

But the ARTIST_QUERY and POST_QUERY don’t return the comments data in their result.
Screen Shot 2022-06-21 at 11.02.06 PM

I need to retrieve all posts data of an artist which also includes comments left for each post.
So I call this query in my Cell, but it doesn’t return comments data.

export const QUERY = gql`
  query FindArtistBySlug($slug: String!) {
    artist: artistBySlug(slug: $slug) {
      songs {
        posts {
          comments {

In my mind, there are two possible cases :

  • Any mistake in defining relationships between COMMENT and POST models in my schema.prisma?
    I don’t think so because same format used in making 1:n relationship between SONG / POST and POST / COMMENT. Whenever I create new post, I can see correct data retrieved in SONG_QUERY.

  • Do I have to run multiple queries in my CELL?

Please help me with this.
I am digging into RedwoodJS but new to it.

Thanks in advance.

Two places I’d suggest looking is:

  1. sdls (probably artists.sdl.ts, songs.sdl.ts, posts.sdl.ts and comments.sdl.ts): Make sure you do have all the fields you’re querying defined there.

  2. services: make sure resolvers are correct. For example in api/src/services/artists/artists.ts, there should be something like:

export const Artist = {

This helps find related records. More details: GraphQL | RedwoodJS Docs

@callingmedic911 Thanks for your reply.

I did fill out the necessary fields in those files, but doesn’t work. :frowning:

I am also having this issue.
And want to solve it.

I got a foreign key in a table Subscriptions that contains the userid from the table users.
but i want to fetch the subscription info from in my usersCell.

Hey all, would it be possible to set up a small reproduction and expectation? I’d be glad to have a look.