Being driven mad by graphql and prisma

has anyone ever had a situation where they have a service returning some object from prisma that works fine, then you try to mutate the object (for filtering before sending to the client) and GraphQL somehow magically decides that is not what you wanted to do and continues sending the same response?

Oddly, if I create a completely new value, GraphQL returns that and crashes, if I use the prisma query result, I can make mutations to it and it will JSON.stringify as the modified value before going into the magic box that is GraphQL, to be turned into the original result from prisma, where none of the filtering has been applied

Hum, this reminds me of an issue where resolvers were taking over very custom data I wanted to return.
To avoid this I made a habit of always declaring specifically every and each field I want to see from my prisma results - which btw is good sql practice. In some rare cases though I’ve had to remove generated resolvers to avoid conflicts.

Must be a better way though.

1 Like