prisma / prisma-client-js

Type-safe database client for TypeScript & Node.js (ORM replacement)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sqlite: PANIC: called `Result::unwrap()` on an `Err` value: Could not parse stored DateTime string: 2020-01-01 00:00:00.348 UTC (input contains invalid characters)

Jolg42 opened this issue · comments

Versions

Name Version
Node v12.14.1
OS darwin
Prisma local

schema.prisma

datasource db {
  provider = "sqlite"
  url      = "file:./dev.db"
  default  = true
}

generator client {
  provider = "prisma-client-js"
}

// / User model comment
model User {
  id    String  @default(uuid()) @id
  email String  @unique
  // / name comment
  name  String?
  posts Post[]
  profile Profile?
  wakesUpAt DateTime? @default("2020-01-01T00:00:00.348Z")
  lastLoginAt DateTime? @default("2020-01-01T00:00:00.348Z")
}

model Profile {
  id     String     @default(cuid()) @id
  bio    String?
  notrequired String?
  user   User    @relation(fields: [userId], references: [id])
  userId String     @unique
  goesToBedAt DateTime? @default("2020-01-01T00:00:00.348Z")
  goesToOfficeAt DateTime? @default("2020-01-01T00:00:00.348Z")
}

model Post {
  id        String   @default(cuid()) @id
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  published Boolean
  title     String
  content   String?
  optionnal String?
  authorId  String? @map("author")
  author    User?    @relation(fields: [authorId], references: [id])
  lastReviewedAt DateTime? @default("2020-01-01T00:00:00.348Z")
  lastPublishedAt DateTime? @default("2020-01-01T00:00:00.348Z")
}

error happens on create

  await prisma.user.create({
    data: {
      email: `a@hey.com`,
      name: `Bob`,
      posts: {
        create: new Array(5).fill(undefined).map((_, i) => ({
          published: true,
          title: 'mytitle',
        })),
      },
      profile: {
        create: {
          bio: 'something',
          notrequired: 'hello',
        },
      },
    },
  })

and the database is empty.

  engine Engine Version query-engine 6a8054bb549e4cc23f157b0010cb2e95cb2637fb +0ms
  engine stdout {
  timestamp: 'Sep 04 14:56:17.454',
  level: 'ERROR',
  target: 'query_engine',
  fields: {
    message: 'PANIC',
    reason: 'called `Result::unwrap()` on an `Err` value: Could not parse stored DateTime string: 2020-01-01 00:00:00.348 UTC (input contains invalid characters)',
    file: 'query-engine/connectors/sql-query-connector/src/row.rs',
    line: 159,
    column: 22
  }
}

Looks like we got a tiny error in TS too

  engine TypeError: this.currentRequestPromise.cancel is not a function
  engine     at NodeEngine.handlePanic (/Users/j42/Dev/prisma/src/packages/client/src/__tests__/runtime-tests/blog-update/node_modules/@prisma/client/runtime/index.js:1:114597)

I am unable to reproduce this in

Environment variables loaded from prisma/.env
@prisma/cli          : 2.8.0-dev.37
Current platform     : darwin
Query Engine         : query-engine 5ed0deef17ce35faf058462e43ccc86fed761dfe (at node_modules/@prisma/cli/query-engine-darwin)
Migration Engine     : migration-engine-cli 5ed0deef17ce35faf058462e43ccc86fed761dfe (at node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core 5ed0deef17ce35faf058462e43ccc86fed761dfe (at node_modules/@prisma/cli/introspection-engine-darwin)
Format Binary        : prisma-fmt 5ed0deef17ce35faf058462e43ccc86fed761dfe (at node_modules/@prisma/cli/prisma-fmt-darwin)
Studio               : 0.292.0

image

@Jolg42 Can you check again?

I ran into this at #957

I am going to close this as its been 3 months now and there is no activity here.

Please reply if you want us to take another look.

@cyrus-za Your issue will be handled via #957