Is it an issue with Prisma or between the chair an...
# prisma-whats-new
j
Is it an issue with Prisma or between the chair and the keyboard that I can't query relations to a Node that I've just created inside 'app' but I can in 'dev'? In app I get Cannot return null for non-nullable field Post.createdBy. I feel like I'm probably missing something really obvious
m
@Joe Fazzino are you using graphql-yoga?
Sounds like there could be a problem with your resolver on the server.
j
I think it is my resolver, yeah I am using yoga. In my resolver all I do is handle the creation with the params, not sure how to do the query part also
createPost(parent, { title, description, createdBy }, ctx, info) { return ctx.db.mutation.createPost( { data: { title, description, createdBy: { connect: { shortID: createdBy } } } } ) },
m
@Joe Fazzino try
Copy code
createPost(parent, { title, description, createdBy }, ctx, info) {
     return ctx.db.mutation.createPost(
       {
         data: {
           title,
           description,
           createdBy: {
             connect: { shortID: createdBy }
           }
         }
       },
       info
     )
   },
the info argument is how you pass the post query to prisma
j
That worked, thanks a lot. I'm annoyed at myself because I've got an article bookmarked that I haven't got around to reading about what the info arg is for 😂