Expected type xxxx to be an object at value.xxxx

prisma

#1

Hello guys,

I have this error that says Expected type CategoryCreateOneWithoutItemsInput to be an object at value.category for some reason and I dont know why if you someone could inform me that would be great :slight_smile:

Mutation

createItem(parent, args, ctx, info) {
// if (!ctx.request.userId) {
//   throw new Error("You must be logged in to do that!");
// }
const item = ctx.db.mutation.createItem(
  {
    data: {
      // This is how to create a relationship between the Item and the User
      user: {
        connect: {
          id: ctx.request.userId
        }
      },
      category: {
        connect: {
          id: args.id
        }
      },
      ...args
    }
  },
  info
);

console.log(item);

return item;

},

I have a relationship between item and category and when I create a new item I am passing the id of the queried category to the item form and submit it but it gives me this error each time I submit it.

Shoot! Variable “$_v0_data” got invalid value {“user”:{“connect”:{“id”:“cjqghmh1jml9t0a988hqa908q”}},“category”:“ck04am7khu4oj0b53nbg7g85k”,“title”:“zsazzzz”,“description”:“asazzzzz”,“price”:2222,“image”:“https://res.cloudinary.com/xxxxx",“largeImage”:"https://res.cloudinary.com/xxxx”}; Expected type CategoryCreateOneWithoutItemsInput to be an object at value.category.