I've spent the last hour trying to get this error,...
# prisma-whats-new
v
I've spent the last hour trying to get this error, and I just don't. I have what should a simple relation: 1 to 1 User/Profile, and trying to create a profile for an already existing user inside the playground:
Copy code
mutation {
  createProfile(userId: "cjcs1tv4k1ga60134mh799k7r") {
    id
    firstName
    lastName
  }
}
getting me the following error:
Copy code
"Variable \"$_where\" got invalid value {\"user\":{\"id\":\"cjcs1tv4k1ga60134mh799k7r\"}}; Field \"user\" is not defined by type UserWhereInput."
the mutation itself is defined and copied like the Link/Vote from the Howtographql.com tutorials (hackernews clone):
Copy code
type Mutation {
  ...
  vote(linkId: ID!): Vote
  createProfile(userId: ID!): Profile
}
I know this might not be the best place to ask about this, if so, please direct me to a better place 🙂
s
Hi, the way I’ve been doing this is to do two mutations. So for you, one call to create a Profile and then one to create the relation between the Profile and User. In my case I have InstagramAccount and ColourReport, so I have to do calls:
const CREATE_INSTAGRAM_ACCOUNT_MUTATION = gql` mutation CreateInstagramAccountMutation($username: String!, $instagramUserId: String) { createInstagramAccount(username: $username, instagramUserId: $instagramUserId) { id username instagramUserId } }
Copy code
const ADD_TO_COLOUR_REPORT_ON_USER_MUTATION = gql
mutation AddToColourReportOnUserMutation( $colourReportId: ID!, $userId: ID!) { addToColourReportOnUser(colourReportsColourReportId: $colourReportId, userUserId: $userId) { colourReportsColourReport { id } userUser { id } } } `
TBH this is pretty long-winded and I’ve not found a way to do a single call, which feels like I’m doing this wrong.