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

Running Prisma Studio causes Fatal Error #841

Closed
DNYLA opened this issue Jan 27, 2022 · 2 comments
Closed

Running Prisma Studio causes Fatal Error #841

DNYLA opened this issue Jan 27, 2022 · 2 comments

Comments

@DNYLA
Copy link

DNYLA commented Jan 27, 2022

  1. Prisma version (prisma -v or npx prisma -v):
prisma                  : 3.8.1
@prisma/client          : 3.8.1
Current platform        : windows
Query Engine (Node-API) : libquery-engine 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at C:\Users\Dan\AppData\Roaming\nvm\v16.12.0\node_modules\prisma\node_modules\@prisma\engines\query_engine-windows.dll.node)   
Migration Engine        : migration-engine-cli 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at C:\Users\Dan\AppData\Roaming\nvm\v16.12.0\node_modules\prisma\node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine    : introspection-core 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at C:\Users\Dan\AppData\Roaming\nvm\v16.12.0\node_modules\prisma\node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary           : prisma-fmt 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at C:\Users\Dan\AppData\Roaming\nvm\v16.12.0\node_modules\prisma\node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash    : 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f
Studio                  : 0.452.0
  1. Logs from Developer Tools Console or Command line, if any:
Invalid string length
RangeError: Invalid string length
    at JSON.stringify (<anonymous>)
    at us.serialize (http://localhost:5555/assets/index.js:1:68556)
    at us.update (http://localhost:5555/assets/index.js:1:14113)
    at yc (http://localhost:5555/assets/vendor.js:41:6994)
    at us.n (http://localhost:5555/assets/vendor.js:41:6688)
    at us.update (http://localhost:5555/assets/index.js:1:68413)
    at yc (http://localhost:5555/assets/vendor.js:41:6994)
    at us.n (http://localhost:5555/assets/vendor.js:41:6688)
    at http://localhost:5555/assets/index.js:1:83629
    at Array.forEach (<anonymous>)
  1. Does the issue persist even after updating to the latest prisma CLI dev version? (npm i -D prisma@dev)
    Yes

  2. Prisma schema (if relevant):
    The Issue occurred when I tried adding @Map("Assignments") to the type enum. I have since removed it but even adding it back doesn't fix the issue.

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

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

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

enum Role {
  USER
  TUTOR
  ADMIN
  BOT
}

enum Subjects {
  maths
  compSci
  english
  chem
  physics
  bio
  other
}

enum Type {
  homework
  exam
  assignment
  hw
  other
}

enum Education {
  uni
  college
  other
}

model User {
  id               String         @id
  username         String
  discriminator    String
  avatar           String?        @default("")
  accessToken      String
  refreshToken     String
  tokenVersion     Int            @default(0)
  role             Role?          @default(USER)
  nodes            RedditConfig[]
  verifiedSubjects Subjects[]
  studentTickets   Ticket[]       @relation("student")
  tutorTickets     Ticket[]       @relation("tutor")
}

model RedditConfig {
  id             Int      @id @default(autoincrement())
  clientId       String
  clientSecret   String
  username       String
  password       String
  userAgent      String
  title          String
  pmBody         String
  subreddits     String[]
  forbiddenWords String[]
  blockedUsers   String[]
  userId         String
  nodeEditors    String[]
  delay          Int      @default(60)
  creator        User     @relation(fields: [userId], references: [id])
  logs           Log[]
}

//Commented Out Relations as Payment Configs can be used across Multiple
//Discord Configs
model DiscordConfig {
  id              String   @id
  name            String?
  icon            String?
  prefix          String   @default("?")
  embedImageUrl   String   @default("https://i.imgur.com/rDzblHE.gif")
  autoSwicher     Boolean  @default(false)
  autoTicket      Boolean  @default(false)
  autoReact       Boolean  @default(false)
  // payment Payment[]
  paymentConfigId String
  // Ticket          Ticket[]
  Ticket          Ticket[]
}

model Payment {
  id       Int    @id @default(autoincrement())
  name     String
  value    String
  type     String // Type 'Unlisted' will exclude it from being displayed. Used for paypal option.
  // discordConfig DiscordConfig @relation(fields: [serverId], references: [id])
  serverId String
}

enum OrderStatus {
  // INITIALIZED // Order has been created in table to link tutor to it
  CREATED // Actual invoice has been created (ie paypal order created)
  PAID // Invoice has been paid
}

model Order {
  id            Int         @id @default(autoincrement())
  status        OrderStatus
  tutorId       String
  transactionId String      @unique
  ticket        Ticket?     @relation(fields: [ticketId], references: [id])
  ticketId      Int? // Ticket id NOT `ticketid` in ticket
}

//Update Client side to not Post ticket until
//It is Finished.
model Ticket {
  id             Int           @id @default(autoincrement())
  serverId       String
  channelId      String        @default("xxx")
  type           Type?
  subject        Subjects?
  education      Education?
  budget         Int
  additionalInfo String        @default("")
  creatorId      String
  tutorId        String?
  due            DateTime
  completed      Boolean       @default(false)
  paid           Boolean       @default(false)
  student        User          @relation("student", fields: [creatorId], references: [id])
  tutor          User?         @relation("tutor", fields: [tutorId], references: [id])
  discordConfig  DiscordConfig @relation(fields: [serverId], references: [id])
  transactions   Order[]
}

model Log {
  id           Int          @id @default(autoincrement())
  nodeId       Int
  message      String
  subId        String
  username     String
  subreddit    String
  pm           Boolean
  createdAt    DateTime     @default(now())
  redditConfig RedditConfig @relation(fields: [nodeId], references: [id])
}


@DNYLA
Copy link
Author

DNYLA commented Jan 27, 2022

Had to clear cookies to fix the issue not sure if this falls under a bug then but you could clear cookies whenever the user clicks the Restart Prisma button.

@janpio
Copy link
Contributor

janpio commented Apr 14, 2022

See #895

@janpio janpio closed this as completed Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants