PANIC: index out of bounds: the len is 1 but the index is 1
Nolty opened this issue · comments
Hi Prisma Team! My Prisma Client just crashed. This is the report:
Versions
Name | Version |
---|---|
Node | v14.15.1 |
OS | debian-openssl-1.1.x |
Prisma Client | 2.13.0-dev.66 |
Logs
prisma-client { clientVersion: '2.13.0-dev.66' }
plusX Execution permissions of /opt/projects/quizzes/server/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x are fine
plusX Execution permissions of /opt/projects/quizzes/server/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x are fine
plusX Execution permissions of /opt/projects/quizzes/server/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x are fine
plusX Execution permissions of /opt/projects/quizzes/server/node_modules/.prisma/client/query-engine-debian-openssl-1.1.x are fine
approximately the same error occurs with the client version 2.12.1.
$ ts-node -T prisma/seed
prisma:info Starting a postgresql pool with 5 connections.
prisma:info Started http server on http+unix:///tmp/prisma-6ee86bea4c403b64a869d8ce.sock
prisma:query BEGIN
prisma:info Starting a postgresql pool with 5 connections.
prisma:info Started http server on http+unix:///tmp/prisma-1b0bd04efa87230f16c6cd65.sock
prisma:query BEGIN
(node:26566) UnhandledPromiseRejectionWarning: Error:
Invalid prisma.user.create()
invocation:
PANIC: index out of bounds: the len is 1 but the index is 1
This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
SCHEMA:
generator prisma_client {
provider = "prisma-client-js"
}
datasource postgres {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
username String @unique
password String
created DateTime @default(now())
updated DateTime @updatedAt
}
CODE:
import { PrismaClient } from '@prisma/client'
import bcrypt from 'bcrypt'
const prisma = new PrismaClient({
log: [
{ emit: "stdout", level: 'query' },
{ emit: 'stdout', level: 'error' },
{ emit: 'stdout', level: 'info' },
{ emit: 'stdout', level: 'warn' },
]
})
async function main() {
prisma.$connect()
await prisma.user.create({
data: {
username: 'test1',
password: bcrypt.hashSync('test1', 12),
}
})
await prisma.user.create({
data: {
username: 'test1',
password: bcrypt.hashSync('test1', 12),
}
})
}
main().finally(async () => {
await prisma.$disconnect()
})
Solved
uninstalled postgresql 13 and installed postgresql 10 on Ubuntu 18.04, the problem was gone, while on Ubuntu 20.04 and postgresql 13 it works fine.
I checked it out with ubuntu 18.04 and pg 13 on latest dev version 2.14.0-dev.60
and it works fine.
I am going to close this. Please comment here if you still experiencing this.