question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PANIC in libs/prisma-models/src/record.rs:161:30 | Invalid coercion encountered: ConversionFailure("Bytes

See original GitHub issue

Bug description

I’m getting an issue where with NestJS, doing a findFirst where a table has multiple binary columns results in a panic.

Can’t post the full https links as it’s too big for github. Hopefully the following will do instead.

npm run start:dev

> [project]-api@0.0.1 start:dev /Users/paul/Share/development/[project]-api
> nest start --watch
[10:50:54] Starting compilation in watch mode...

[10:50:57] Found 0 errors. Watching for file changes.

  prisma:tryLoadEnv Environment variables loaded from /Users/paul/Share/development/[project]-api/.env +0ms
[dotenv][DEBUG] did not match key and value when parsing line 1: # Environment variables declared in this file are automatically made available to Prisma.
[dotenv][DEBUG] did not match key and value when parsing line 2: # See the documentation for more detail: https://pris.ly/d/prisma-schema#using-environment-variables
[dotenv][DEBUG] did not match key and value when parsing line 3:
[dotenv][DEBUG] did not match key and value when parsing line 4: # Prisma supports the native connection string format for PostgreSQL, MySQL and SQLite.
[dotenv][DEBUG] did not match key and value when parsing line 5: # See the documentation for all the connection string options: https://pris.ly/d/connection-strings
[dotenv][DEBUG] did not match key and value when parsing line 6:
[dotenv][DEBUG] did not match key and value when parsing line 7: #DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
[dotenv][DEBUG] did not match key and value when parsing line 11:
  express:application set "x-powered-by" to true +0ms
  express:application set "etag" to 'weak' +1ms
  express:application set "etag fn" to [Function: generateETag] +0ms
  express:application set "env" to 'development' +1ms
  express:application set "query parser" to 'extended' +0ms
  express:application set "query parser fn" to [Function: parseExtendedQueryString] +0ms
  express:application set "subdomain offset" to 2 +0ms
  express:application set "trust proxy" to false +0ms
  express:application set "trust proxy fn" to [Function: trustNone] +1ms
  express:application booting in development mode +0ms
  express:application set "view" to [Function: View] +0ms
  express:application set "views" to '/Users/paul/Share/development/[project]-api/views' +0ms
  express:application set "jsonp callback name" to 'callback' +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [NestFactory] Starting Nest application...
  prisma:tryLoadEnv Environment variables loaded from /Users/paul/Share/development/[project]-api/.env +301ms
[dotenv][DEBUG] did not match key and value when parsing line 1: # Environment variables declared in this file are automatically made available to Prisma.
[dotenv][DEBUG] did not match key and value when parsing line 2: # See the documentation for more detail: https://pris.ly/d/prisma-schema#using-environment-variables
[dotenv][DEBUG] did not match key and value when parsing line 3:
[dotenv][DEBUG] did not match key and value when parsing line 4: # Prisma supports the native connection string format for PostgreSQL, MySQL and SQLite.
[dotenv][DEBUG] did not match key and value when parsing line 5: # See the documentation for all the connection string options: https://pris.ly/d/connection-strings
[dotenv][DEBUG] did not match key and value when parsing line 6:
[dotenv][DEBUG] did not match key and value when parsing line 7: #DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
[dotenv][DEBUG] did not match key and value when parsing line 11:
[dotenv][DEBUG] "DATABASE_URL" is already defined in `process.env` and will not be overwritten
[dotenv][DEBUG] "FE_HOST" is already defined in `process.env` and will not be overwritten
[dotenv][DEBUG] "FE_PORT" is already defined in `process.env` and will not be overwritten
  prisma:client clientVersion: 2.23.0-dev.27 +0ms
  prisma:tryLoadEnv Environment variables loaded from /Users/paul/Share/development/[project]-api/.env +20ms
[dotenv][DEBUG] did not match key and value when parsing line 1: # Environment variables declared in this file are automatically made available to Prisma.
[dotenv][DEBUG] did not match key and value when parsing line 2: # See the documentation for more detail: https://pris.ly/d/prisma-schema#using-environment-variables
[dotenv][DEBUG] did not match key and value when parsing line 3:
[dotenv][DEBUG] did not match key and value when parsing line 4: # Prisma supports the native connection string format for PostgreSQL, MySQL and SQLite.
[dotenv][DEBUG] did not match key and value when parsing line 5: # See the documentation for all the connection string options: https://pris.ly/d/connection-strings
[dotenv][DEBUG] did not match key and value when parsing line 6:
[dotenv][DEBUG] did not match key and value when parsing line 7: #DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
[dotenv][DEBUG] did not match key and value when parsing line 11:
[dotenv][DEBUG] "DATABASE_URL" is already defined in `process.env` and will not be overwritten
[dotenv][DEBUG] "FE_HOST" is already defined in `process.env` and will not be overwritten
[dotenv][DEBUG] "FE_PORT" is already defined in `process.env` and will not be overwritten
  prisma:client clientVersion: 2.23.0-dev.27 +26ms
  prisma:engine Search for Query Engine in /Users/paul/Share/development/[project]-api/node_modules/.prisma/client +0ms
  prisma:engine Search for Query Engine in /Users/paul/Share/development/[project]-api/node_modules/.prisma/client +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [InstanceLoader] MulterModule dependencies initialized +93ms
[Nest] 12401   - 16/05/2021, 10:50:58   [InstanceLoader] HttpModule dependencies initialized +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [InstanceLoader] ConfigHostModule dependencies initialized +1ms
[Nest] 12401   - 16/05/2021, 10:50:58   [InstanceLoader] AppModule dependencies initialized +1ms
[Nest] 12401   - 16/05/2021, 10:50:58   [InstanceLoader] OverlayModule dependencies initialized +1ms
[Nest] 12401   - 16/05/2021, 10:50:58   [InstanceLoader] ConfigModule dependencies initialized +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [InstanceLoader] DamModule dependencies initialized +1ms
  express:router use '/' query +102ms
  express:router:layer new '/' +0ms
  express:router use '/' expressInit +0ms
  express:router:layer new '/' +0ms
  express:router use '/' corsMiddleware +1ms
  express:router:layer new '/' +0ms
  express:router use '/' jsonParser +1ms
  express:router:layer new '/' +0ms
  express:router use '/' urlencodedParser +0ms
  express:router:layer new '/' +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [RoutesResolver] AppController {/api}: +7ms
  express:router:route new '/api' +5ms
  express:router:layer new '/api' +0ms
  express:router:route get '/api' +1ms
  express:router:layer new '/' +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [RouterExplorer] Mapped {/api, GET} route +4ms
[Nest] 12401   - 16/05/2021, 10:50:58   [RoutesResolver] OverlayController {/api/overlay}: +0ms
  express:router:route new '/api/overlay/getFonts/:type' +1ms
  express:router:layer new '/api/overlay/getFonts/:type' +0ms
  express:router:route get '/api/overlay/getFonts/:type' +0ms
  express:router:layer new '/' +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [RouterExplorer] Mapped {/api/overlay/getFonts/:type, GET} route +2ms
  express:router:route new '/api/overlay/getScaffold/:type' +1ms
  express:router:layer new '/api/overlay/getScaffold/:type' +0ms
  express:router:route get '/api/overlay/getScaffold/:type' +0ms
  express:router:layer new '/' +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [RouterExplorer] Mapped {/api/overlay/getScaffold/:type, GET} route +0ms
  express:router:route new '/api/overlay/download' +1ms
  express:router:layer new '/api/overlay/download' +0ms
  express:router:route get '/api/overlay/download' +0ms
  express:router:layer new '/' +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [RouterExplorer] Mapped {/api/overlay/download, GET} route +1ms
[Nest] 12401   - 16/05/2021, 10:50:58   [RoutesResolver] DamController {/api/dam}: +0ms
  express:router:route new '/api/dam/upload' +1ms
  express:router:layer new '/api/dam/upload' +0ms
  express:router:route post '/api/dam/upload' +0ms
  express:router:layer new '/' +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [RouterExplorer] Mapped {/api/dam/upload, POST} route +2ms
  express:router:route new '/api/dam/images/:imgpath' +1ms
  express:router:layer new '/api/dam/images/:imgpath' +0ms
  express:router:route get '/api/dam/images/:imgpath' +0ms
  express:router:layer new '/' +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [RouterExplorer] Mapped {/api/dam/images/:imgpath, GET} route +0ms
  prisma:engine { cwd: '/Users/paul/Share/development/[project]-api/prisma' } +25ms
  prisma:engine Search for Query Engine in /Users/paul/Share/development/[project]-api/node_modules/.prisma/client +1ms
  plusX Execution permissions of /Users/paul/Share/development/[project]-api/node_modules/.prisma/client/query-engine-darwin are fine +0ms
  plusX Execution permissions of /Users/paul/Share/development/[project]-api/node_modules/.prisma/client/query-engine-darwin are fine +20ms
  plusX Execution permissions of /Users/paul/Share/development/[project]-api/node_modules/.prisma/client/query-engine-darwin are fine +8ms
  prisma:engine { flags: [ '--enable-raw-queries', '--port', '55383' ] } +31ms
  prisma:engine stdout Starting a mysql pool with 9 connections. +38ms
  prisma:engine stdout Started http server on http://127.0.0.1:55383 +46ms
  prisma:engine Search for Query Engine in /Users/paul/Share/development/[project]-api/node_modules/.prisma/client +1ms
  prisma:engine { cwd: '/Users/paul/Share/development/[project]-api/prisma' } +1ms
  prisma:engine Search for Query Engine in /Users/paul/Share/development/[project]-api/node_modules/.prisma/client +0ms
  plusX Execution permissions of /Users/paul/Share/development/[project]-api/node_modules/.prisma/client/query-engine-darwin are fine +89ms
  plusX Execution permissions of /Users/paul/Share/development/[project]-api/node_modules/.prisma/client/query-engine-darwin are fine +7ms
  prisma:engine { flags: [ '--enable-raw-queries', '--port', '55386' ] } +8ms
  prisma:engine Client Version: 2.23.0-dev.27 +15ms
  prisma:engine Engine Version: query-engine 936e9b9eb66e6b265d1d25f687dd97f6ff479d7f +1ms
  prisma:engine Active provider: mysql +0ms
  prisma:engine stdout Starting a mysql pool with 9 connections. +17ms
  prisma:engine stdout Started http server on http://127.0.0.1:55386 +44ms
  prisma:engine Search for Query Engine in /Users/paul/Share/development/[project]-api/node_modules/.prisma/client +1ms
  express:router use '/' <anonymous> +208ms
  express:router:layer new '/' +0ms
  express:router use '/' <anonymous> +1ms
  express:router:layer new '/' +0ms
[Nest] 12401   - 16/05/2021, 10:50:58   [NestApplication] Nest application successfully started +210ms
  plusX Execution permissions of /Users/paul/Share/development/[project]-api/node_modules/.prisma/client/query-engine-darwin are fine +83ms
  prisma:engine Client Version: 2.23.0-dev.27 +25ms
  prisma:engine Engine Version: query-engine 936e9b9eb66e6b265d1d25f687dd97f6ff479d7f +0ms
  prisma:engine Active provider: mysql +0ms
  express:router dispatching OPTIONS /api/dam/upload +1m
  express:router query  : /api/dam/upload +3ms
  express:router expressInit  : /api/dam/upload +2ms
  express:router corsMiddleware  : /api/dam/upload +1ms
  express:router dispatching POST /api/dam/upload +8ms
  express:router query  : /api/dam/upload +0ms
  express:router expressInit  : /api/dam/upload +0ms
  express:router corsMiddleware  : /api/dam/upload +0ms
  express:router jsonParser  : /api/dam/upload +0ms
  body-parser:json content-type "multipart/form-data; boundary=----WebKitFormBoundary4wBB4Mi3NjC2JJEt" +0ms
  body-parser:json skip parsing +2ms
  express:router urlencodedParser  : /api/dam/upload +3ms
  body-parser:urlencoded content-type "multipart/form-data; boundary=----WebKitFormBoundary4wBB4Mi3NjC2JJEt" +0ms
  body-parser:urlencoded skip parsing +1ms
  prisma:tryLoadEnv Environment variables loaded from /Users/paul/Share/development/[project]-api/.env +1m
[dotenv][DEBUG] did not match key and value when parsing line 1: # Environment variables declared in this file are automatically made available to Prisma.
[dotenv][DEBUG] did not match key and value when parsing line 2: # See the documentation for more detail: https://pris.ly/d/prisma-schema#using-environment-variables
[dotenv][DEBUG] did not match key and value when parsing line 3:
[dotenv][DEBUG] did not match key and value when parsing line 4: # Prisma supports the native connection string format for PostgreSQL, MySQL and SQLite.
[dotenv][DEBUG] did not match key and value when parsing line 5: # See the documentation for all the connection string options: https://pris.ly/d/connection-strings
[dotenv][DEBUG] did not match key and value when parsing line 6:
[dotenv][DEBUG] did not match key and value when parsing line 7: #DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
[dotenv][DEBUG] did not match key and value when parsing line 11:
[dotenv][DEBUG] "DATABASE_URL" is already defined in `process.env` and will not be overwritten
[dotenv][DEBUG] "FE_HOST" is already defined in `process.env` and will not be overwritten
[dotenv][DEBUG] "FE_PORT" is already defined in `process.env` and will not be overwritten
  prisma:client clientVersion: 2.23.0-dev.27 +1m
  prisma:client Prisma Client call: +12ms
  prisma:client prisma.damFileMimeType.findFirst({
  prisma:client   where: {
  prisma:client     mime: 'image/jpeg'
  prisma:client   }
  prisma:client }) +2ms
  prisma:client Generated request: +0ms
  prisma:client query {
  prisma:client   findFirstDamFileMimeType(where: {
  prisma:client     mime: "image/jpeg"
  prisma:client   }) {
  prisma:client     id
  prisma:client     mime
  prisma:client     extension
  prisma:client     createdAt
  prisma:client     updatedAt
  prisma:client     deletedAt
  prisma:client     typeId
  prisma:client   }
  prisma:client }
  prisma:client  +0ms
  prisma:engine Search for Query Engine in /Users/paul/Share/development/[project]-api/node_modules/.prisma/client +1m
  prisma:engine { cwd: '/Users/paul/Share/development/[project]-api/prisma' } +4ms
  prisma:engine Search for Query Engine in /Users/paul/Share/development/[project]-api/node_modules/.prisma/client +1ms
  plusX Execution permissions of /Users/paul/Share/development/[project]-api/node_modules/.prisma/client/query-engine-darwin are fine +1m
  plusX Execution permissions of /Users/paul/Share/development/[project]-api/node_modules/.prisma/client/query-engine-darwin are fine +16ms
  prisma:engine { flags: [ '--enable-raw-queries', '--port', '55690' ] } +17ms
  express:router dispatching GET /api/dam/images/ba6-495a.jpg +119ms
  express:router query  : /api/dam/images/ba6-495a.jpg +1ms
  express:router expressInit  : /api/dam/images/ba6-495a.jpg +0ms
  express:router corsMiddleware  : /api/dam/images/ba6-495a.jpg +0ms
  express:router jsonParser  : /api/dam/images/ba6-495a.jpg +0ms
  body-parser:json skip empty body +120ms
  express:router urlencodedParser  : /api/dam/images/ba6-495a.jpg +1ms
  body-parser:urlencoded skip empty body +0ms
  send stat "/Users/paul/Share/development/[project]-api/upload/ba6-495a.jpg" +0ms
  send pipe "/Users/paul/Share/development/[project]-api/upload/ba6-495a.jpg" +2ms
  send accept ranges +0ms
  send cache-control public, max-age=0 +0ms
  send modified Sun, 16 May 2021 09:52:09 GMT +0ms
  send etag W/"6f0f-179749717dd" +1ms
  send content-type image/jpeg +0ms
  prisma:engine stdout Starting a mysql pool with 9 connections. +135ms
prisma:info Starting a mysql pool with 9 connections.
  prisma:engine stdout Fetched a connection from the pool +53ms
prisma:info Fetched a connection from the pool
  prisma:engine stdout Started http server on http://127.0.0.1:55690 +0ms
prisma:info Started http server on http://127.0.0.1:55690
  prisma:engine Search for Query Engine in /Users/paul/Share/development/[project]-api/node_modules/.prisma/client +14ms
  plusX Execution permissions of /Users/paul/Share/development/[project]-api/node_modules/.prisma/client/query-engine-darwin are fine +203ms
  prisma:engine stdout Fetched a connection from the pool +10ms
prisma:info Fetched a connection from the pool
  prisma:engine Client Version: 2.23.0-dev.27 +13ms
  prisma:engine Engine Version: query-engine 936e9b9eb66e6b265d1d25f687dd97f6ff479d7f +0ms
  prisma:engine Active provider: mysql +0ms
  prisma:engine stdout Unknown error +54ms
{
  timestamp: 2021-05-16T09:52:10.050Z,
  query: 'SELECT `[project]`.`DamFileMimeType`.`id`, `[project]`.`DamFileMimeType`.`mime`, `[project]`.`DamFileMimeType`.`extension`, `[project]`.`DamFileMimeType`.`createdAt`, `[project]`.`DamFileMimeType`.`updatedAt`, `[project]`.`DamFileMimeType`.`deletedAt`, `[project]`.`DamFileMimeType`.`typeId` FROM `[project]`.`DamFileMimeType` WHERE `[project]`.`DamFileMimeType`.`mime` = ? LIMIT ? OFFSET ?',
  params: '["image/jpeg",1,0]',
  duration: 65,
  target: 'quaint::connector::metrics'
}
  prisma:engine stdout PANIC in libs/prisma-models/src/record.rs:161:30
Invalid coercion encountered: ConversionFailure("Bytes([48, 49, 67, 68, 65, 70, 83, 69, 48, 56, 53, 89, 51, 52, 49, 57, 87, 72, 80, 86, 72, 57, 66, 67, 82, 74])", "Bytes") +1ms
prisma:error PANIC in libs/prisma-models/src/record.rs:161:30
Invalid coercion encountered: ConversionFailure("Bytes([48, 49, 67, 68, 65, 70, 83, 69, 48, 56, 53, 89, 51, 52, 49, 57, 87, 72, 80, 86, 72, 57, 66, 67, 82, 74])", "Bytes")
  prisma:engine {
  prisma:engine   error: SocketError: other side closed
  prisma:engine       at Socket.onSocketEnd (/Users/paul/Share/development/[project]-api/node_modules/@prisma/client/runtime/index.js:25530:24)
  prisma:engine       at Socket.emit (events.js:327:22)
  prisma:engine       at endReadableNT (internal/streams/readable.js:1327:12)
  prisma:engine       at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  prisma:engine     code: 'UND_ERR_SOCKET'
  prisma:engine   }
  prisma:engine } +4ms
  prisma:engine {
  prisma:engine   error: Error: connect ECONNREFUSED 127.0.0.1:55690
  prisma:engine       at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  prisma:engine     errno: -61,
  prisma:engine     code: 'ECONNREFUSED',
  prisma:engine     syscall: 'connect',
  prisma:engine     address: '127.0.0.1',
  prisma:engine     port: 55690
  prisma:engine   }
  prisma:engine } +11ms
  prisma:engine { cwd: '/Users/paul/Share/development/[project]-api/prisma' } +2ms
  prisma:engine Search for Query Engine in /Users/paul/Share/development/[project]-api/node_modules/.prisma/client +2ms
  plusX Execution permissions of /Users/paul/Share/development/[project]-api/node_modules/.prisma/client/query-engine-darwin are fine +98ms
  prisma:engine { flags: [ '--enable-raw-queries', '--port', '55700' ] } +1ms
  prisma:engine stdout Starting a mysql pool with 9 connections. +33ms
prisma:info Starting a mysql pool with 9 connections.
  prisma:engine stdout Fetched a connection from the pool +41ms
prisma:info Fetched a connection from the pool
  prisma:engine stdout Started http server on http://127.0.0.1:55700 +1ms
prisma:info Started http server on http://127.0.0.1:55700
  prisma:engine Search for Query Engine in /Users/paul/Share/development/[project]-api/node_modules/.prisma/client +1ms
  plusX Execution permissions of /Users/paul/Share/development/[project]-api/node_modules/.prisma/client/query-engine-darwin are fine +76ms
  prisma:engine stdout Fetched a connection from the pool +8ms
prisma:info Fetched a connection from the pool
  prisma:engine Client Version: 2.23.0-dev.27 +15ms
  prisma:engine Engine Version: query-engine 936e9b9eb66e6b265d1d25f687dd97f6ff479d7f +0ms
  prisma:engine Active provider: mysql +0ms
  prisma:engine stdout Unknown error +10ms
{
  timestamp: 2021-05-16T09:52:10.181Z,
  query: 'SELECT `[project]`.`DamFileMimeType`.`id`, `[project]`.`DamFileMimeType`.`mime`, `[project]`.`DamFileMimeType`.`extension`, `[project]`.`DamFileMimeType`.`createdAt`, `[project]`.`DamFileMimeType`.`updatedAt`, `[project]`.`DamFileMimeType`.`deletedAt`, `[project]`.`DamFileMimeType`.`typeId` FROM `[project]`.`DamFileMimeType` WHERE `[project]`.`DamFileMimeType`.`mime` = ? LIMIT ? OFFSET ?',
  params: '["image/jpeg",1,0]',
  duration: 24,
  target: 'quaint::connector::metrics'
}
  prisma:engine stdout PANIC in libs/prisma-models/src/record.rs:161:30
Invalid coercion encountered: ConversionFailure("Bytes([48, 49, 67, 68, 65, 70, 83, 69, 48, 56, 53, 89, 51, 52, 49, 57, 87, 72, 80, 86, 72, 57, 66, 67, 82, 74])", "Bytes") +1ms
prisma:error PANIC in libs/prisma-models/src/record.rs:161:30
Invalid coercion encountered: ConversionFailure("Bytes([48, 49, 67, 68, 65, 70, 83, 69, 48, 56, 53, 89, 51, 52, 49, 57, 87, 72, 80, 86, 72, 57, 66, 67, 82, 74])", "Bytes")
  prisma:engine {
  prisma:engine   error: SocketError: other side closed
  prisma:engine       at Socket.onSocketEnd (/Users/paul/Share/development/[project]-api/node_modules/@prisma/client/runtime/index.js:25530:24)
  prisma:engine       at Socket.emit (events.js:327:22)
  prisma:engine       at endReadableNT (internal/streams/readable.js:1327:12)
  prisma:engine       at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  prisma:engine     code: 'UND_ERR_SOCKET'
  prisma:engine   }
  prisma:engine } +3ms
  prisma:client Error: PANIC in libs/prisma-models/src/record.rs:161:30
  prisma:client Invalid coercion encountered: ConversionFailure("Bytes([48, 49, 67, 68, 65, 70, 83, 69, 48, 56, 53, 89, 51, 52, 49, 57, 87, 72, 80, 86, 72, 57, 66, 67, 82, 74])", "Bytes")
  prisma:client
  prisma:client This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
  prisma:client
  
  prisma:client
  prisma:client If you want the Prisma team to look into it, please open the link above 🙏
  prisma:client To increase the chance of success, please post your schema and a snippet of
  prisma:client how you used Prisma Client in the issue.
  prisma:client
  prisma:client     at NodeEngine.throwAsyncErrorIfExists (/Users/paul/Share/development/[project]-api/node_modules/@prisma/client/runtime/index.js:27787:21)
  prisma:client     at NodeEngine.handleRequestError (/Users/paul/Share/development/[project]-api/node_modules/@prisma/client/runtime/index.js:27101:14)
  prisma:client     at processTicksAndRejections (internal/process/task_queues.js:93:5)
  prisma:client     at async NodeEngine.request (/Users/paul/Share/development/[project]-api/node_modules/@prisma/client/runtime/index.js:27721:9)
  prisma:client     at async cb (/Users/paul/Share/development/[project]-api/node_modules/@prisma/client/runtime/index.js:35067:26)
  prisma:client     at async DamService.checkFileType (/Users/paul/Share/development/[project]-api/dist/dam/dam.service.js:100:23) +438ms
(node:12401) UnhandledPromiseRejectionWarning: Error:
Invalid `prisma.damFileMimeType.findFirst()` invocation:


  PANIC in libs/prisma-models/src/record.rs:161:30
Invalid coercion encountered: ConversionFailure("Bytes([48, 49, 67, 68, 65, 70, 83, 69, 48, 56, 53, 89, 51, 52, 49, 57, 87, 72, 80, 86, 72, 57, 66, 67, 82, 74])", "Bytes")

This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.

If you want the Prisma team to look into it, please open the link above 🙏
To increase the chance of success, please post your schema and a snippet of
how you used Prisma Client in the issue.

    at cb (/Users/paul/Share/development/[project]-api/node_modules/@prisma/client/runtime/index.js:35101:17)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async DamService.checkFileType (/Users/paul/Share/development/[project]-api/dist/dam/dam.service.js:100:23)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:12401) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12401) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

How to reproduce

simple query on data should suffice.

Expected behavior

Should not crash and show result.

Prisma information

Using NestJS:

const query = await this.prisma.damFileMimeType.findFirst({
      where: {
        mime: mimeType,
      },
    });

    console.log('query', query);

Models:

model DamFileType {
  id        Bytes     @id @db.Binary(26)
  name      String    @db.VarChar(30)
  createdAt DateTime  @default(now())
  updatedAt DateTime? @updatedAt
  deletedAt DateTime?

  // relations
  DamFileMimeTypes DamFileMimeType[]
  DamFiles         DamFile[]
}

model DamFileMimeType {
  id        Bytes     @id @db.Binary(26)
  mime      String    @db.VarChar(30)
  extension String    @db.VarChar(4)
  createdAt DateTime  @default(now())
  updatedAt DateTime? @updatedAt
  deletedAt DateTime?

  // relations
  type     DamFileType @relation(fields: [typeId], references: [id])
  typeId   Bytes       @db.Binary(26)
  DamFiles DamFile[]
}

Data:

INSERT INTO `DamFileType` (id, name, createdAt, updatedAt, deletedAt) VALUES ('01CDAFSDGAZD5F6CHXX4FZR2SK','image','2019-03-11 14:47:48','2019-03-11 09:13:25',NULL);

INSERT INTO `DamFileMimeType` (id, typeId, mime, extension, createdAt, updatedAt, deletedAt) VALUES ('01CDAFSE085Y3419WHPVH9BCRJ','01CDAFSDGAZD5F6CHXX4FZR2SK','image/jpeg','jpg','2019-09-24 14:09:43','2019-09-24 14:09:43',NULL)

Environment & setup

  • OS: osx
  • Database: mariadb Ver 15.1 Distrib 10.5.8-MariaDB, for osx10.14 (x86_64) using readline 5.1
  • Node.js version: v14.15.4
  • Prisma version:
prisma               : 2.23.0-dev.27
@prisma/client       : 2.23.0-dev.27
Current platform     : darwin
Query Engine         : query-engine 936e9b9eb66e6b265d1d25f687dd97f6ff479d7f (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine     : migration-engine-cli 936e9b9eb66e6b265d1d25f687dd97f6ff479d7f (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 936e9b9eb66e6b265d1d25f687dd97f6ff479d7f (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary        : prisma-fmt 936e9b9eb66e6b265d1d25f687dd97f6ff479d7f (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash : 936e9b9eb66e6b265d1d25f687dd97f6ff479d7f
Studio               : 0.393.0

Have tried past 2 versions and same result.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dpetrickcommented, Aug 5, 2021

This will be fixed in 2.29.

1reaction
pantharshit00commented, May 19, 2021

I can reproduce this, thanks for the detailed reproduction.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found