Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PANIC in query-engine/core/src/interpreter/query_interpreters/inmemory_record_processor.rs:111:80called Result::unwrap() on an Err value: FieldNotFound { name: "origin", model: "Field not found in record Record { values: [Int(1011), String(\"https://woman.mynavi.jp/article/190924-7/\")], parent_id: None }. Field names are: [\"id\", \"link\"], looking for: \"origin\"" } #5969

Closed
kentozuka opened this issue Mar 4, 2021 · 4 comments · Fixed by prisma/prisma-engines#1768
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: broken query
Milestone

Comments

@kentozuka
Copy link

Hi Prisma Team! My Prisma Client just crashed. This is the report:

Versions

Name Version
Node v12.16.3
OS darwin
Prisma Client 2.18.0
Query Engine query-engine da6fafb57b24e0b61ca20960c64e2d41f9e8cff1
Database undefined

Query

query {
  findManySite(
    distinct: [origin]
    where: {
      snapshotId: 5
    }
  ) {
    id
    link
  }
}

Logs

in record Record { values: [Int(1011), String(\\\"https://woman.mynavi.jp/article/190924-7/\\\")], parent_id: None }. Field names are: [\\\"id\\\", \\\"link\\\"], looking for: \\\"origin\\\"\" }","file":"query-engine/core/src/interpreter/query_interpreters/inmemory_record_processor.rs","line":111,"column":80},"target":"query_engine","span":{"name":"execute_single_operation"},"spans":[{"name":"execute_single_operation"}]}  
  prisma:engine {
  prisma:engine   error: SocketError: other side closed
  prisma:engine       at Socket.onSocketEnd (/Users/ron/code/custom_search_crawling/local_test/second/node_modules/@prisma/client/runtime/index.js:25190:25)
  prisma:engine       at Socket.emit (events.js:322:22)
  prisma:engine       at endReadableNT (_stream_readable.js:1187:12)
  prisma:engine       at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  prisma:engine     code: 'UND_ERR_SOCKET'
  prisma:engine   }
  prisma:engine }  
  prisma:engine {
  prisma:engine   cwd: '/Users/ron/code/custom_search_crawling/local_test/second/prisma'
  prisma:engine }  
  prisma:engine Search for Query Engine in /Users/ron/code/custom_search_crawling/local_test/second/node_modules/.prisma/client  
  plusX Execution permissions of /Users/ron/code/custom_search_crawling/local_test/second/node_modules/.prisma/client/query-engine-darwin are fine  
  prisma:engine {
  prisma:engine   flags: [
  prisma:engine     '--enable-experimental=createMany',
  prisma:engine     '--enable-raw-queries',
  prisma:engine     '--port',
  prisma:engine     '51636'
  prisma:engine   ]
  prisma:engine }  
  prisma:engine stdout  Starting a postgresql pool with 5 connections.  
  prisma:engine stdout  Started http server on http://127.0.0.1:51636  
  prisma:engine Search for Query Engine in /Users/ron/code/custom_search_crawling/local_test/second/node_modules/.prisma/client  
  plusX Execution permissions of /Users/ron/code/custom_search_crawling/local_test/second/node_modules/.prisma/client/query-engine-darwin are fine  
  prisma:engine Client Version: 2.18.0  
  prisma:engine Engine Version: query-engine da6fafb57b24e0b61ca20960c64e2d41f9e8cff1  
  prisma:engine Active provider: postgresql  
  prisma:engine stdout  PANIC in query-engine/core/src/interpreter/query_interpreters/inmemory_record_processor.rs:111:80
called `Result::unwrap()` on an `Err` value: FieldNotFound { name: "origin", model: "Field not found in record Record { values: [Int(1011), String(\"https://woman.mynavi.jp/article/190924-7/\")], parent_id: None }. Field names are: [\"id\", \"link\"], looking for: \"origin\"" }  
  prisma:engine TypeError: this.currentRequestPromise.cancel is not a function
  prisma:engine     at NodeEngine.handlePanic (/Users/ron/code/custom_search_crawling/local_test/second/node_modules/@prisma/client/runtime/index.js:26934:36)
  prisma:engine     at NodeEngine.setError (/Users/ron/code/custom_search_crawling/local_test/second/node_modules/@prisma/client/runtime/index.js:26880:16)
  prisma:engine     at LineStream.<anonymous> (/Users/ron/code/custom_search_crawling/local_test/second/node_modules/@prisma/client/runtime/index.js:27170:24)
  prisma:engine     at LineStream.emit (events.js:310:20)
  prisma:engine     at addChunk (_stream_readable.js:286:12)
  prisma:engine     at readableAddChunk (_stream_readable.js:268:9)
  prisma:engine     at LineStream.Readable.push (_stream_readable.js:209:10)
  prisma:engine     at LineStream.Transform.push (_stream_transform.js:152:32)
  prisma:engine     at LineStream._pushBuffer (/Users/ron/code/custom_search_crawling/local_test/second/node_modules/@prisma/client/runtime/index.js:24055:19)
  prisma:engine     at LineStream._transform (/Users/ron/code/custom_search_crawling/local_test/second/node_modules/@prisma/client/runtime/index.js:24049:10)  {"timestamp":"Mar 04 12:25:10.348","level":"ERROR","fields":{"message":"PANIC","reason":"called `Result::unwrap()` on an `Err` value: FieldNotFound { name: \"origin\", model: \"Field not found in record Record { values: [Int(1011), String(\\\"https://woman.mynavi.jp/article/190924-7/\\\")], parent_id: None }. Field names are: [\\\"id\\\", \\\"link\\\"], looking for: \\\"origin\\\"\" }","file":"query-engine/core/src/interpreter/query_interpreters/inmemory_record_processor.rs","line":111,"column":80},"target":"query_engine","span":{"name":"execute_single_operation"},"spans":[{"name":"execute_single_operation"}]}  
  prisma:engine {
  prisma:engine   error: SocketError: other side closed
  prisma:engine       at Socket.onSocketEnd (/Users/ron/code/custom_search_crawling/local_test/second/node_modules/@prisma/client/runtime/index.js:25190:25)
  prisma:engine       at Socket.emit (events.js:322:22)
  prisma:engine       at endReadableNT (_stream_readable.js:1187:12)
  prisma:engine       at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  prisma:engine     code: 'UND_ERR_SOCKET'
  prisma:engine   }
  prisma:engine }  

Client Snippet

// PLEASE FILL YOUR CODE SNIPPET HERE
const { prisma } = require('./helpers/prisma')

async function main () {
  const data = await prisma.site.findMany({
    distinct: ['origin'],
    where: {
      snapshotId: 4,
    },
    select: {
      id: true,
      link: true
    }
  })

  console.log(data)
}

main().finally(async () => await prisma.$disconnect())

Schema

// PLEASE ADD YOUR SCHEMA HERE IF POSSIBLE
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
  previewFeatures = ["createMany"]
}

model Project {
  id Int @id @default(autoincrement())
  name String
  description String
  created String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  lists List[]
  searches Search[]
}

model List {
  id Int @id @default(autoincrement())
  project Project @relation(fields: [projectId], references: [id])
  projectId Int
  name String
  created String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  phrases Phrase[]
  snapshots Snapshot[]
}

model Search {
  id Int @id @default(autoincrement())
  project Project @relation(fields: [projectId], references: [id])
  projectId Int
  name String
  archived Boolean
  created String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  words Word[]
  snapshots Snapshot[]
  targets Target[]
  knownlists Knownlist[]
}

model Phrase {
  id Int @id @default(autoincrement())
  list List @relation(fields: [listId], references: [id])
  listId Int
  content String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  sites Site[]
}

model Snapshot {
  id Int @id @default(autoincrement())
  list List @relation(fields: [listId], references: [id])
  listId Int
  name String
  length Int
  depth Int
  created String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  sites Site[]
  searches Search[]
  affiliates Affiliate[]
}

model Word {
  id Int @id @default(autoincrement())
  search Search @relation(fields: [searchId], references: [id])
  searchId Int
  content String
  forUrlMatching Boolean
  createdAt DateTime @default(now())
}

model Target {
  id Int @id @default(autoincrement())
  search Search @relation(fields: [searchId], references: [id])
  searchId Int
  title String
  href String
  thumbnail String?
  created String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  affiliates Affiliate[]
}

model Knownlist {
  id Int @id @default(autoincrement())
  title String?
  origin String
  colored Boolean
  default Boolean
  reason String?
  thumbnail String?
  created String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  searches Search[] // これないとどうなるの???
}

model Site {
  id Int @id @default(autoincrement())
  snaphost Snapshot @relation(fields: [snapshotId], references: [id])
  snapshotId Int
  phrase Phrase @relation(fields: [phraseId], references: [id])
  phraseId Int
  // media Media? @relation(fields: [origin], references: [origin])
  origin String
  rank Int
  title String?
  htmlTitle String?
  link String
  displayLink String?
  snippet String?
  htmlSnippet String?
  cacheId String?
  formattedUrl String?
  htmlFormattedUrl String?
  pagemap Json?
  body String?
  status Int?
  time Int?
  created String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  affiliate Affiliate?
}

model Affiliate {
  id Int @id @default(autoincrement())
  target Target @relation(fields: [targetId], references: [id])
  targetId Int
  snapshot Snapshot @relation(fields: [snapshotId], references: [id])
  snapshotId Int
  site Site @relation(fields: [siteId], references: [id])
  siteId Int
  attempt Int
  href String
  html String
  chain Json
  createdAt DateTime @default(now())
  chains Chain[]
}

model Media {
  id Int @id @default(autoincrement())
  fid String
  title String?
  link String
  protocol String
  host String
  origin String @unique
  thumbnail String?
  created String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  // sites Site[]
}

model Provider {
  id Int @id @default(autoincrement())
  origin String @unique
  created String
  createdAt DateTime @default(now())
  // chins Chain[]
}

model Chain {
  id Int @id @default(autoincrement())
  affiliate Affiliate @relation(fields: [affiliateId], references: [id])
  affiliateId Int
  index Int
  href String
  // provider Provider @relation(fields: [origin], references: [origin])
  origin String
}

model Process {
  id String @unique
  type Int
  parentId Int
  childId Int
  started String
  ended String?
  error String?
}

Hope this helps!

@pantharshit00 pantharshit00 added bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. process/candidate team/client Issue for team Client. topic: broken query labels Mar 10, 2021
@pantharshit00
Copy link
Contributor

I can reproduce this crash. Thanks for reporting. I made a reproduction with some sample data for reproduction: https://github.com/harshit-test-org/prisma-issue-5969

@pantharshit00
Copy link
Contributor

Another report with a simpler reproduction: #6048

@Miabread
Copy link

I want to note that I fixed the panic when I selected the distinct fields:

const query = await prisma.entry.findMany({
    select: {
        shop: true,
        name: true,
         year: true,
    },
    distinct: ['name', 'year'],
});

Not sure if this is intended or not.

@pantharshit00
Copy link
Contributor

@jamesBeeProg A panic is not intended so it will be patched

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. topic: broken query
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants