Prisma-client-js: Prisma Client 2.2.2 reports generic crash for DateTime type with invalid data

Created on 8 Aug 2020  路  2Comments  路  Source: prisma/prisma-client-js

Versions

| Name | Version |
|----------|--------------------|
| Node | v13.14.0 |
| OS | debian-openssl-1.1.x|
| Prisma | 2.2.2 |

Logs

  prisma-client {
  prisma-client   engineConfig: {
  prisma-client     cwd: '/c/users/alec/code/jyosuushi/prisma',
  prisma-client     debug: false,
  prisma-client     datamodelPath: '/c/users/alec/code/jyosuushi/node_modules/.prisma/client/schema.prisma',
  prisma-client     prismaPath: undefined,
  prisma-client     engineEndpoint: undefined,
  prisma-client     generator: {
  prisma-client       name: 'client',
  prisma-client       provider: 'prisma-client-js',
  prisma-client       output: '/c/users/alec/code/jyosuushi/node_modules/@prisma/client',
  prisma-client       binaryTargets: [],
  prisma-client       experimentalFeatures: [Array],
  prisma-client       config: {}
  prisma-client     },
  prisma-client     showColors: false,
  prisma-client     logLevel: undefined,
  prisma-client     logQueries: undefined,
  prisma-client     flags: [],
  prisma-client     clientVersion: '2.2.2',
  prisma-client     enableExperimental: [ 'aggregations' ]
  prisma-client   }
  prisma-client }  +0ms
  prisma-client Prisma Client call:  +16s
  prisma-client prisma.activeUserSession.findOne({
  prisma-client   where: {
  prisma-client     id: '37498e1a-299f-480e-bd48-bfc46e59c56a'
  prisma-client   }
  prisma-client })  +1ms
  prisma-client Generated request:  +0ms
  prisma-client query {
  prisma-client   findOneActiveUserSession(where: {
  prisma-client     id: "37498e1a-299f-480e-bd48-bfc46e59c56a"
  prisma-client   }) {
  prisma-client     expiration
  prisma-client     id
  prisma-client     userId
  prisma-client   }
  prisma-client }
  prisma-client   +0ms
  plusX Execution permissions of /c/users/alec/code/jyosuushi/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x are fine  +0ms
  prisma-client Client Version 2.2.2  +210ms
  prisma-client Engine Version a9e8c3d97ef2a0cf59256e6b26097f2a80f0a6a4  +0ms
  prisma-client Prisma Client call:  +65ms
  prisma-client prisma.user.findOne({
  prisma-client   where: {
  prisma-client     id: '5202d6f3-f982-48bc-a089-b80d1c5518e9'
  prisma-client   }
  prisma-client })  +0ms
  prisma-client Generated request:  +0ms
  prisma-client query {
  prisma-client   findOneUser(where: {
  prisma-client     id: "5202d6f3-f982-48bc-a089-b80d1c5518e9"
  prisma-client   }) {
  prisma-client     dateRegistered
  prisma-client     email
  prisma-client     encryptedPassword
  prisma-client     id
  prisma-client   }
  prisma-client }
  prisma-client   +0ms

Description

I received the following generic crash log/general error when I was developing locally against a SQLite database. My prisma schema for the relevant tables looks like so:

model ActiveUserSession {
  expiration DateTime
  id         String   @id
  userId     String
  User       User     @relation(fields: [userId], references: [id])
}

model User {
  dateRegistered    DateTime
  email             String              @unique
  encryptedPassword String
  id                String              @id
  ActiveUserSession ActiveUserSession[]
}

In the end, I dug a bit deeper (and got fairly lucky) and was able to figure out that the dateRegistered value for the user ID I was querying wasn't a numerical timestamp (1596837600) but instead the date string format that you get with CURRENT_TIMESTAMP in SQLite ("2020-08-08 03:57:18").

To be clear, me reporting this issue isn't asking for additional support for the date type; I handled the bad data on my end and a full adoption of Prisma will hopefully prevent it from happening in the future, which is the expected use case. Rather, I wanted to report this because I felt that the error report for this could be improved to help track down this kind of error in the future if it were to crop up again.

bu0-needs-info kinbug basic reporting issue

All 2 comments

Hey @ahlec

Sorry for the late reply here. Can you please try this again with latest version 2.6.1 and see if this is still a problem. If this is still a problem, we can take a look.

Tested it on 2.6.1 and the error message provided gives the information I'd expect, so I'd consider this fixed. Thank you so much!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

divyenduz picture divyenduz  路  3Comments

AhmedElywa picture AhmedElywa  路  4Comments

julien1619 picture julien1619  路  3Comments

Vergil333 picture Vergil333  路  3Comments

divyenduz picture divyenduz  路  4Comments