prisma: Prisma 2 not working with Nestjs

Bug description

Prisma 2 is not working using latest NestJS.

Error Debug Failure.

image

How to reproduce

Reproduction repository : https://github.com/LeoMartinDev/nestjs-prisma-bug

Basic NestJS and Prisma setup does not work (see https://docs.nestjs.com/recipes/prisma)

Expected behavior

We should be able to use Prisma

Prisma information

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

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model DiscordAuth {
  id           Int      @id @default(autoincrement())
  discordId    String   @unique
  accessToken  String   @unique
  refreshToken String   @unique
  tokenType    String
  expiresAt    DateTime
  scope        String
  userId       Int      @unique
  user         User     @relation(fields: [userId], references: [id])
}

model User {
  id          Int          @id @default(autoincrement())
  username    String
  email       String       @unique
  discordAuth DiscordAuth?
}

Environment & setup

  • OS: Windows - WSL 2 Ubuntu
  • Database: PostgreSQL
  • Node.js version: v14.15.0
  • Prisma version:
prisma               : 2.17.0
@prisma/client       : 2.17.0
Current platform     : debian-openssl-1.1.x
Query Engine         : query-engine 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/query-engine-debian-openssl-1.1.x)
Migration Engine     : migration-engine-cli 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary        : prisma-fmt 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Studio               : 0.353.0

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 19 (8 by maintainers)

Most upvoted comments

šŸ‘ It works ! Using "typescript": "^4.3.0-dev.20210302" image

It should be fine for development but idk about production environment, hope Typescript 4.3 is ready soon

Thanks for your time / help @pantharshit00 ! šŸŽ‰

@LeoMartinDev Thanks for asking this question. I was also encountering the same issue at around the same time. Glad that there is a workaround at least for now!

@pantharshit00 Thanks for the research on the error. TBH, I’m starting to really like using prisma with nestjs. This might/might not solve until the next stable release on Typescript 4.3. But until we can make sure that it working all right, I think this issues should be reopened.

It would be great if you guys can collaborate with the typescript community to solve this issue ASAP.

Hey, looks like TS 4.3 dev fixes this.

image

Can you verify this? Tested on 4.3.0-dev.20210302

I am unable to reproduce this after following the tutorial step by step: image

It correctly bootstrapped the server correctly. Please make sure you are following the tutorial step by step properly.

I am going to close this. If you can still reproduce this even after a second try, please upload the code to github repository so that I can take a look.