Weird problem w/ relations in graphql-yoga / prisma proj


#1

prisma 1.2.8
node 9.4
bash on win10
graphql-yoga 1.3.2

i can’t reproduce this or determine which part of the stack this problem was occurring, so i figured i’d post here and see if anyone else has seen this.

I have a few types that are connected, like (this is all pseudo code obvs):

type Purchase {
  item: Item!
}

type Item {
  ...
  widget: Widget!
}

type Widget {
   ...
   storeItems: [Item!]!
}

when I query directly against Prisma like so:

query {
    purchases {
        item {
            widget {
                id
            }
        }
    }
}

i get valid results, like:

data: {
 purchases: [
     { item: { widget: { id: "blahblah" }} },
     { item: { widget: { id: "blahblah2" }} }
 ]
}

However, when querying the purchase query on my graphql-yoga endpoint (which just delegates to prisma and returns type Purchase), the return payload for that query looks like this:

data: {
 purchases: [
     { item: null },
     { item: null }
 ]
}

tl;dr: queries against my prisma endpoint return correct entities and relations, but queries against graphql-yoga, which are delegated to prisma, return null for connections.

Now the weird part and why i can’t reproduce: when I rebooted my system, the problem disappeared and the query works fine.

it’s worth noting that i’ve been seeing weird behavior, maybe w/ nodemon, where the server is killed but the process runs on. this sometimes means my changes aren’t reflected in the response, but I can’t reason how that could be connected to this.

anyone see this before? not holding me up but would like to know what caused it so i can prevent it in the future.


#2

I think I had similar question.

This might be helpful.


#3

I ran across this recently, this is not a bug but is intended behaviour.

I found the solution in the below article.