ERROR", parsed_severity: Some(Error), code: SqlState(E22003), message: "integer out of range for type int4

This  error occurs whenever I try to add a new object to my model on Next js connected to a postgresql database hosted on CockroachDB using prisma client.

Type: undefined
Invalid `` invocation:

Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E22003), message: "integer out of range for type int4", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("eval.go"), line: Some(35), routine: Some("init") }) }), transient: false })

Code: undefined

[object Object]

Here are the contents of my schema file

// This is your Prisma schema file,
// learn more about it in the docs:

generator client {
  provider = "prisma-client-js"

// datasource db {
//   provider = "sqlite"
//   // url      = env("DATABASE_URL")
//   url      = "file:./dev.db"
// }

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")

model Account {
  id                String  @id @default(cuid())
  userId            String
  type              String
  provider          String
  providerAccountId String
  refresh_token     String? //@db.Text
  access_token      String? //@db.Text
  expires_at        Int?
  token_type        String?
  scope             String?
  id_token          String? //@db.Text
  session_state     String?

  user User @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@unique([provider, providerAccountId])

model Session {
  id           String   @id @default(cuid())
  sessionToken String   @unique
  userId       String
  expires      DateTime
  user         User     @relation(fields: [userId], references: [id], onDelete: Cascade)

model User {
  id            String    @id @default(cuid())
  name          String?
  email         String?   @unique
  emailVerified DateTime?
  image         String?
  accounts      Account[]
  sessions      Session[]
  author        Author[]
  comment       Comment[]
  createdAt     DateTime  @default(now())

model VerificationToken {
  identifier String
  token      String   @unique
  expires    DateTime

  @@unique([identifier, token])

model Author {
  id      String    @id @default(cuid())
  name    String
  email   String    @default("unknown")
  image   String
  bio     String
  user    User      @relation(fields: [userId], references: [id])
  userId  String
  article Article[]

model Category {
  id      String    @id @default(cuid())
  name    String    @unique
  article Article[]

model Article {
  id         String    @id @default(cuid())
  author     Author    @relation(fields: [authorId], references: [id])
  authorId   String
  title      String
  body       String
  image      String
  summary    String
  category   Category  @relation(fields: [categoryId], references: [id])
  categoryId String
  slug       String    @unique @default("Uknown")
  views      Int       @default(0)
  createdAt  DateTime  @default(now())
  comment    Comment[]
  tags       String    @default("unknown")

model Comment {
  id        String   @id @default(cuid())
  user      User     @relation(fields: [userId], references: [id])
  userId    String
  body      String
  createdAt DateTime @default(now())
  article   Article  @relation(fields: [articleId], references: [id])
  articleId String


message profile

This error occurs becuse you are using Int 

Add Message

Click on the button below to add a new message to this thread


#Javascript #deployment #next js

Thread detail

Satus: Open
Messages: 1Started: 2023-05-24
Thread Create
Click the button below to start a new thread for your question




Frontend Development |Backend Development |Full Website Development |Bootstrap Website upgrades | Website Debbugging | Website Hosting & deployment


Interested in hiring me or collaborating with me on a project, click on any of the links below to get my social media handle

Or contact me via Tel: (+234)-806-225-7480 | Email:
Privacy Policy

By using our website,
you agree that devmaesters can store cookies on your device and disclose information in accordance with our privacy policy.