Hey all, having an issue with Prisma's update muta...
# prisma-whats-new
c
Hey all, having an issue with Prisma's update mutation:
Copy code
const updateUser = await ctx.db.mutation.updateUser(
            {
                where: { id: user.id },
                data: {
                    password: hash,
                    resetToken: null,
                    resetExpiry: null
                },
            }
        )
When I run this mutation, nothing happens to
resetToken
and
resetExpiry
in the db (their values don't get set to
null
). They're not required in my data model, either:
Copy code
#
    verifyToken: String @unique
    resetToken: String @unique
    resetExpiry: DateTime
Anyone else experiencing this issue? I'm on prisma@1.1.2
m
@ckelley that's odd. could be that the resetToken and resetExpiry don't get updated because it ignores null inputs. Might be worth checking with the graphcool team @nilan
c
@max I agree, that's a likely cause. i'll check github again
@nilan is this a bug or a feature that i'm just misunderstanding?
will file a report on github if it's the former
n
hiho, do you have debug logs enabled in your GraphQL Yoga server? What is the actual query being sent out?
c
lemme get that for you!
Copy code
mutation ($_data: UserUpdateInput!, $_where: UserWhereUniqueInput!) {
  updateUser(data: $_data, where: $_where) {
    id
    # ...
    verifyToken
    resetToken
    resetExpiry
    # ...
  }
}
Copy code
{
  "_data": {
    "emailVerified": true,
    "verifyToken": null
  },
  "_where": {
    "id": "cjd0vvumo01e10108958vtxoh"
  }
}
Copy code
Response from <http://192.168.99.100:4466/prisma-test/dev>:
{
  "updateUser": {
    (snip)
    "id": "cjd0vvumo01e10108958vtxoh",
    "verifyToken": "9f5abda51816526227cce41c692c86856e460091",
    (snip)
  }
}
n
that looks like an entirely different input than in your previous snippet
c
yeah, it is, sorry
it's the exact same functionality though, setting something to null
n
got it now, was just confused! 😄
c
same scenario:
Copy code
const updateUser = await ctx.db.mutation.updateUser(
            {
                where: { id: user.id },
                data: {
                    emailVerified: true,
                    verifyToken: null,
                },
            }
        )
Copy code
verifyToken: String @unique
n
this indeed looks like a bug to me, could you share some reproduction info here: https://github.com/graphcool/prisma 🙂
c
i'll file! what would you call the js portion of prisma? the "prisma sdk"? or just prisma
n
do you refer to
prisma-binding
?
ctx.db.query
is running
prisma-binding
c
yeah, that's it!
n
you use
prisma-binding
in the context of your GraphQL Server, for example GraphQL Yoga
cheers!
n
thanks so much! 🙂 will take a look