prisma / studio

🎙️ The easiest way to explore and manipulate your data in all of your Prisma projects.
https://www.prisma.io/studio
1.89k stars 47 forks source link

Unable to delete table rows with Byte ids #804

Open MarcGuiselin opened 2 years ago

MarcGuiselin commented 2 years ago
  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==",
  },
}
)
```

3. Does the issue persist even after updating to the latest `prisma` alpha? (`npm i -D @prisma/cli@dev`)

Yes

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

model Session {
  hashedToken Bytes @id
}
```
MarcGuiselin commented 2 years ago

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 commented 2 years ago

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
sdnts commented 2 years ago

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!

MarcGuiselin commented 2 years ago

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

MarcGuiselin commented 2 years ago

@madebysid