Skip to content

PrismaClientExceptionFilter throws TypeError when used with driver adapter and rust-free Prisma engine #116

@anotheri

Description

@anotheri

Not sure it that's related to driver adapter and custom output which i've setup as discussed in #112 or just to latest nestjs updates, but i've noticed that if i use app.useGlobalFilters(new PrismaClientExceptionFilter(httpAdapter)); as I did before, it throws an following error if i try to open the path without handler

TypeError: Right-hand side of 'instanceof' is not an object
    at /usr/src/app/node_modules/@nestjs/common/utils/select-exception-filter-metadata.util.js:5:60
    at Array.some (<anonymous>)
    at /usr/src/app/node_modules/@nestjs/common/utils/select-exception-filter-metadata.util.js:5:24
    at Array.find (<anonymous>)
    at selectExceptionFilterMetadata (/usr/src/app/node_modules/@nestjs/common/utils/select-exception-filter-metadata.util.js:4:71)
    at ExceptionsHandler.invokeCustomFilters (/usr/src/app/node_modules/@nestjs/core/exceptions/exceptions-handler.js:29:98)
    at ExceptionsHandler.next (/usr/src/app/node_modules/@nestjs/core/exceptions/exceptions-handler.js:14:18)
    at /usr/src/app/node_modules/@nestjs/core/router/router-proxy.js:25:35
    at Layer.handleError (/usr/src/app/node_modules/router/lib/layer.js:116:17)
    at trimPrefix (/usr/src/app/node_modules/router/index.js:340:13)

For example, I use global /api prefix, registered like this:

app.setGlobalPrefix('api');

And therefore there is no / handler, but when i try to open / i get the error mentioned above. Any clue or known workaround on this issue?

I'm on the latest nestjs dependencies:

"@nestjs/common": "^11.1.6",
"@nestjs/core": "^11.1.6",
"@nestjs/microservices": "^11.1.6",
"@nestjs/platform-express": "^11.1.6",

And my prisma client generator look like this:

// prisma/schema.prisma
generator client {
  provider   = "prisma-client"
  output     = "../src/generated/prisma-client"
  engineType = "client"
}

And if i disable global prisma client exception filter, i'm getting standard and expected express.js response:

{"message":"Cannot GET /","error":"Not Found","statusCode":404}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions