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.

In 2.24.0 `createMany` errors with: `PANIC in query-engine/connectors/sql-query-connector/src/database/operations/write.rs:95:60called `Result::unwrap()` on an `Err` value: ScalarFieldNotFound { name: "updated_at", model: "FundMangerTeamMemberExperience" }`

See original GitHub issue

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

Versions

Name Version
Node v12.20.1
OS debian-openssl-1.1.x
Prisma Client 2.24.0
Query Engine query-engine f3e341280d96d0abc068f97e959ddf01f321a858
Database postgresql

Query

mutation {
  createOneFundMangerTeamMember(data: {
    fundMangerTeamMemberExperience: {
      createMany: {
        data: [
          {
            name: "X"
            logo: "X"
            tenure: "X"
          }
        ]
      }
    }
    fundMangerTeamMemberInvestmentExperience: {
      createMany: {
        data: [
          {
            companyName: "X"
            logo: "X"
          }
        ]
      }
    }
    fundmanagerId: 5
    name: "X"
    yearsOfExperience: 5
    designation: "X"
    image: "X"
    brief: "X"
  }) {
    id
    name
    yearsOfExperience
    designation
    image
    brief
    fundmanagerId
    createdAt
    updatedAt
  }
}

Logs

ion permissions of /home/ubuntu/work/goal/goal-server/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x are fine  
  prisma:engine stdout  Starting a postgresql pool with 3 connections.  
  prisma:engine stdout  Started http server on http://127.0.0.1:39877  
  prisma:engine Search for Query Engine in /home/ubuntu/work/goal/goal-server/node_modules/.prisma/client  
  plusX Execution permissions of /home/ubuntu/work/goal/goal-server/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x are fine  
  prisma:engine Client Version: 2.24.0  
  prisma:engine Engine Version: query-engine f3e341280d96d0abc068f97e959ddf01f321a858  
  prisma:engine Active provider: postgresql  
  prisma:engine stdout  PANIC in query-engine/connectors/sql-query-connector/src/database/operations/write.rs:95:60
called `Result::unwrap()` on an `Err` value: ScalarFieldNotFound { name: "updated_at", model: "FundMangerTeamMemberExperience" }  +2s
  prisma:engine {
  prisma:engine   error: SocketError: other side closed
  prisma:engine       at Socket.onSocketEnd (/home/ubuntu/work/goal/goal-server/node_modules/@prisma/client/runtime/index.js:26072:24)
  prisma:engine       at Socket.emit (events.js:326:22)
  prisma:engine       at Socket.EventEmitter.emit (domain.js:506:15)
  prisma:engine       at endReadableNT (_stream_readable.js:1241: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   error: Error: connect ECONNREFUSED 127.0.0.1:39877
  prisma:engine       at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
  prisma:engine       at TCPConnectWrap.callbackTrampoline (internal/async_hooks.js:126:14) {
  prisma:engine     errno: 'ECONNREFUSED',
  prisma:engine     code: 'ECONNREFUSED',
  prisma:engine     syscall: 'connect',
  prisma:engine     address: '127.0.0.1',
  prisma:engine     port: 39877
  prisma:engine   }
  prisma:engine }  
  prisma:engine { cwd: '/home/ubuntu/work/goal/goal-server/prisma' }  
  prisma:engine Search for Query Engine in /home/ubuntu/work/goal/goal-server/node_modules/.prisma/client  
  plusX Execution permissions of /home/ubuntu/work/goal/goal-server/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x are fine  +2s
  prisma:engine { flags: [ '--enable-raw-queries', '--port', '46169' ] }  
  prisma:engine stdout  Starting a postgresql pool with 3 connections.  
  prisma:engine stdout  Started http server on http://127.0.0.1:46169  
  prisma:engine Search for Query Engine in /home/ubuntu/work/goal/goal-server/node_modules/.prisma/client  
  plusX Execution permissions of /home/ubuntu/work/goal/goal-server/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x are fine  
  prisma:engine Client Version: 2.24.0  
  prisma:engine Engine Version: query-engine f3e341280d96d0abc068f97e959ddf01f321a858  
  prisma:engine Active provider: postgresql  
  prisma:engine stdout  PANIC in query-engine/connectors/sql-query-connector/src/database/operations/write.rs:95:60
called `Result::unwrap()` on an `Err` value: ScalarFieldNotFound { name: "updated_at", model: "FundMangerTeamMemberExperience" }  
  prisma:engine {
  prisma:engine   error: SocketError: other side closed
  prisma:engine       at Socket.onSocketEnd (/home/ubuntu/work/goal/goal-server/node_modules/@prisma/client/runtime/index.js:26072:24)
  prisma:engine       at Socket.emit (events.js:326:22)
  prisma:engine       at Socket.EventEmitter.emit (domain.js:506:15)
  prisma:engine       at endReadableNT (_stream_readable.js:1241:12)
  prisma:engine       at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  prisma:engine     code: 'UND_ERR_SOCKET'
  prisma:engine   }
  prisma:engine }  

Client Snippet

const data = await fundMangerTeamMemberSchema.validateAsync(req.body)
    let { investmentExperience, workExperience, ...teamMembersDetails } = data

    console.log(data)
    await db.fundMangerTeamMember.create({
      data: {
        fundMangerTeamMemberExperience: {
          createMany: { data: workExperience }
        },
        fundMangerTeamMemberInvestmentExperience: {
          createMany: { data: investmentExperience }
        },
        ...teamMembersDetails
      }
    })

Schema

model Fundmanager {
  id                 Int                             @id @default(autoincrement())
  fundMangerTeamMember             FundMangerTeamMember[]

  @@map("fundmanagers")
}


model FundMangerTeamMember {
  id                Int     @id @default(autoincrement())
  name              String
  yearsOfExperience Int?    @map("years_of_experience")
  designation       String
  image             String?
  brief             String?

  // relations
  fundMangerTeamMemberExperience           FundMangerTeamMemberExperience[]
  fundMangerTeamMemberInvestmentExperience FundMangerTeamMemberInvestmentExperience[]
  fundmanager                              Fundmanager?                               @relation(fields: [fundmanagerId], references: [id])
  fundmanagerId                            Int?


  //
  createdAt DateTime @default(now()) @map("created_at")
  updatedAt DateTime @default(now()) @map("updated_at")

  @@map("fund_manger_team_member")
}

model FundMangerTeamMemberExperience {
  id     Int     @id @default(autoincrement())
  name   String?
  logo   String?
  tenure String?

  // relations
  fundManagerTeamMember  FundMangerTeamMember @relation(fields: [fundMangerTeamMemberId], references: [id])
  fundMangerTeamMemberId Int

  //
  createdAt DateTime @default(now()) @map("created_at")
  updatedAt DateTime @default(now()) @map("updated_at")

  @@map("fund_manger_team_member_experience")
}

model FundMangerTeamMemberInvestmentExperience {
  id          Int     @id @default(autoincrement())
  companyName String? @map("company_name")
  logo        String?

  // relations
  fundMangerTeamMember   FundMangerTeamMember? @relation(fields: [fundMangerTeamMemberId], references: [id])
  fundMangerTeamMemberId Int?

  //
  createdAt DateTime @default(now()) @map("created_at")
  updatedAt DateTime @default(now()) @map("updated_at")

  @@map("fund_manger_team_member_investment_experience")
}```

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Jolg42commented, Jun 3, 2021

The patch is out in 2.24.1 🚢 💯

2reactions
benjamintdcommented, Jun 2, 2021

I ran into a very similar issue where default values were not found when using createMany (e.g. updated_at, created_at, as well as join ids).

A seed that used to run under 2.22.1 stopped working in 2.23 and 2.24, so this seems to be a bug introduced in 2.23.

@akshilshah Going back to 2.22.1 solved that issue for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix "createMany does not exists..." in prisma?
I'm using createMany to insert multiple data in just a query (see code below). But the problem is, it does not recognize createMany...
Read more >
Error Handling in Go on Exercism
Implement various kinds of error handling and resource management. ... It returns a Resource and error value in the idiomatic Go fashion:.
Read more >
Improving error handling - panics vs. proper errors
Currently, the ersatz codebase contains a mix of Result<T, E> , and some methods that panic, like unwrap() and expect() . We also...
Read more >
Errors in Go: From denial to acceptance - Evil Martians
Error handling is an integral part of programming, but in many popular languages, it comes as an afterthought. The godfather of numerous ...
Read more >
Handling errors | golang-book - GitHub Pages
The idea is to return a value and an error object from a function call. ... At the top is the error string...
Read more >

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