firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

[Data Connect] Cannot reset nullable column to `null` via GraphQL `tablename_update`

Open tttocklll opened this issue 1 year ago • 4 comments

[REQUIRED] Environment info

firebase-tools: 14.2.0

Platform: macOS

[REQUIRED] Test case

dataconnect/schema/schema.gql

type User @table(key: "id") {
  id: String! @default(expr: "auth.uid")
  createdAt: Timestamp! @col(name: "created_at")
  deletedAt: Timestamp @col(name: "deleted_at")  # nullable
}

[REQUIRED] Steps to reproduce

  1. update deletedAt of a user with non-null value
mutation SetDeletedAt($userId: String!) {
  user_update(
    id: $userId
    data: { deletedAt_expr: "request.time" }
  )
}
  1. update deletedAt of the user with null
mutation SetDeletedAtToNull($userId: String!) {
  user_update(
    id: $userId
    data: { deletedAt: null }
  )
}

We also tried:

  • replace deletedAt with deletedAt_expr in the mutation
  • replade null with NULL, "null", and "NULL"

[REQUIRED] Expected behavior

deletedAt of the specified user is set to null

[REQUIRED] Actual behavior

Mutation succeeds, but deletedAt of the user remains unchanged.

tttocklll avatar Apr 24 '25 08:04 tttocklll

Same issue here. unable to update a value to null.

kotaroyamazaki avatar Apr 24 '25 09:04 kotaroyamazaki

Thanks for the report! I will try to repro and have a fix ready soon

fredzqm avatar Apr 25 '25 17:04 fredzqm

I have a fix. Should come out in next release.

fredzqm avatar Apr 25 '25 18:04 fredzqm

Closing this since the fix is in on the emulator side. This will go out in this week's release.

joehan avatar Apr 29 '25 17:04 joehan