studio icon indicating copy to clipboard operation
studio copied to clipboard

Unable to delete table rows with Byte ids

Open MarcGuiselin opened this issue 4 years ago • 5 comments

  1. Prisma version (prisma -v or npx prisma -v):
prisma                  : 3.0.2
@prisma/client          : 3.0.2
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at ../../node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : 2452cc6313d52b8b9a96999ac0e974d0aedf88db
Studio                  : 0.423.0
  1. Logs from Developer Tools Console or Command line, if any:
Type: undefined
Message: 
Invalid `prisma.session.delete()` invocation:

{
  where: {
    hashedToken: 'KORtDyuUQcz0VOEHga5DOQ=='
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~
  }
}

Argument hashedToken: Got invalid value 'KORtDyuUQcz0VOEHga5DOQ==' on prisma.deleteOneSession. Provided String, expected Bytes.



Code: undefined

Query:
prisma.session.delete(
{
  where: {
    hashedToken: "KORtDyuUQcz0VOEHga5DOQ==",
  },
}
)
  1. Does the issue persist even after updating to the latest prisma alpha? (npm i -D @prisma/cli@dev)

Yes

  1. Prisma schema (if relevant):
datasource db {
  provider = "postgres"
  url      = env("DATABASE_URL")
}

model Session {
  hashedToken Bytes @id
}

MarcGuiselin avatar Nov 24 '21 05:11 MarcGuiselin

This issue occurs when manually trying to delete records in the prisma studio desktop app as show below. Prisma studio should use a buffer rather than a string to find and delete this row. image image

MarcGuiselin avatar Nov 24 '21 05:11 MarcGuiselin

Issue persists with Prisma v3.6.0.

Example repo: https://github.com/MarcGuiselin/prisma-bug/

prisma                  : 3.6.0
@prisma/client          : 3.6.0
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : dc520b92b1ebb2d28dc3161f9f82e875bd35d727
Studio                  : 0.440.0

MarcGuiselin avatar Dec 11 '21 18:12 MarcGuiselin

Hey @MarcGuiselin, could you give 3.7.0 a shot as well? I haven't looked at your issue specifically, but there's been a fundamental change in how Studio makes its queries, and I think this may have been addressed. If not, let me know and I'll take a look. Thanks!

sdnts avatar Dec 24 '21 12:12 sdnts

Thanks Sid, unfortunately, it still throws the same error in 3.7.0

MarcGuiselin avatar Dec 28 '21 18:12 MarcGuiselin

@madebysid

MarcGuiselin avatar Jan 09 '22 21:01 MarcGuiselin

Hey :wave:

Prisma ORM 7 introduces a brand new standalone Studio, built from the ground up to work everywhere, with or without Prisma ORM. Consequently, all "old Studio" issues are being closed as there won't be any further work on it. :mega:

The new Studio is also available in the Prisma VS Code extension and in the Prisma Console application. :electric_plug:

Help shape, improve and fix the new Studio with us in this repository by submitting bug reports and feature requests. :construction_worker:

igalklebanov avatar Nov 20 '25 01:11 igalklebanov