prisma: `generate`: "Error: Schema parsing --- thread 'main' has overflowed its stack"

$ prisma2 generate
(node:21024) ExperimentalWarning: The fs.promises API is experimental
Error: Schema parsing
thread 'main' has overflowed its stack
error Command failed with exit code 1.

Seems to be Windows related and related to Rust it’s stack size limit which is 1MB on Windows; (that’s what I’ve found on the interwebs)

Running it in Docker seems to fix it since that’s unix, but then when starting the project from Windows CLI it complains about not finding the windows query engine since the generate was done in unix 🤦‍♂ Happened after adding a new model to my prisma-schema, probably increased the necessary stack_size with that causing it to error.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (13 by maintainers)

Most upvoted comments

I have a convenient way to reproduce this on my machine, working on a fix now.

For people running into the same issue. You can run the project in docker and run generate command from there. To start a container from within your current working folder in powershell:

docker run -p 8080:8080  -it -v ${PWD}:/home/dev keymetrics/pm2:10-jessie /bin/bash 

or in bash

docker run -p 8080:8080  -it -v /${PWD}:/home/dev keymetrics/pm2:10-jessie /bin/bash 

This launches a bash shell inside the container, you can then run any commands that you used to run from the folder /home/dev

For example:

cd home/dev
npm run generate (-> prisma2 generate) 
npm run seed (-> ts-node prisma/seed)
npm run dev (-> cross-env NODE_ENV=development nodemon)

@janpio

generator photon {
  provider = "photonjs"
}

datasource postgresql {
  provider  = "postgresql"
  url       = env("POSTGRES_URL")
  enabled   = true
}

model Domain  {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  name          String   @unique
  description   String?
  logo          String?   
  email         String
  telephone     String
  mobile   String
  website       String?

  address       DomainAddress?
  organisations Organisation[] @relation(onDelete: CASCADE)
  contact       Contact?

  deleted       Boolean @default(false)
}

model DomainAddress {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  street        String?
  number        String?
  bus           String?
  zip           String
  city          String
  country       String?

  domain        Domain

  deleted       Boolean @default(false)
}

model Organisation  {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  name          String   @unique
  description   String?
  logo          String?   
  email         String
  telephone     String
  mobile        String
  website       String?
  
  domain        Domain
  address       OrganisationAddress?
  departments   Department[] @relation(onDelete: CASCADE)
  contact       Contact?
  customers     Customer[]

  deleted       Boolean @default(false)
}

model OrganisationAddress {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  street        String?
  number        String?
  bus           String?
  zip           String
  city          String
  country       String?

  domain        Domain?
  organisation  Organisation

  deleted       Boolean @default(false)
}

model Department  {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  name          String   @unique
  description   String?
  logo          String?   
  email         String
  telephone     String
  mobile        String
  website       String?
  
  organisation  Organisation
  domain        Domain?
  address       DepartmentAddress?
  locations     Location[]
  contact       Contact?
  activities    Activity[]

  deleted       Boolean @default(false)
}

model DepartmentAddress {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  street        String?
  number        String?
  bus           String?
  zip           String
  city          String
  country       String?

  domain        Domain?
  organisation  Organisation?
  department    Department

  deleted       Boolean @default(false)
}

model Location  {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  name          String   @unique
  description   String?
  email         String?
  telephone     String?
  mobile        String?
  website       String?
  visitComputers Int?
  visitsEnabled  Boolean @default(false)
  
  department    Department
  domain        Domain?
  organisation  Organisation?
  address       LocationAddress?
  contact       Contact?
  classrooms    Classroom[]
  accessories   Accessory[]
  visits        Visit[]
  openingSlots  OpeningSlot[]

  deleted       Boolean @default(false)
}

model LocationAddress {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  street        String?
  number        String?
  bus           String?
  zip           String
  city          String
  country       String?

  domain        Domain?
  organisation  Organisation?
  department    Department?
  location      Location

  deleted       Boolean @default(false)
}

model Classroom {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  name          String
  computers     Int

  location      Location
  domain        Domain?
  organisation  Organisation?
  department    Department?

  deleted       Boolean @default(false)
}

model Accessory {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  amount        Int
  type          AccessoryType
  inUse         Boolean @default(false)
  props         String?

  location      Location
  domain        Domain?
  organisation  Organisation?
  department    Department?

  deleted       Boolean @default(false)
}

enum AccessoryType {
  COMPUTER
  HEADPHONE
  MOUSE
  KEYBOARD
  TABLET
  MOBILEPHONE
  WEBCAM
}

model Visit {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  checkIn       DateTime @default(now())
  checkOut      DateTime?
  note          String?
  usesComputer  Boolean @default(true)

  location      Location
  customer      Customer
  domain        Domain?
  organisation  Organisation?
  department    Department?

  deleted       Boolean @default(false)
}

model Contact {
  id    String @default(cuid()) @id

  firstname String
  lastname  String
  email     String
  mobile    String

  deleted       Boolean @default(false)
}

model Customer {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  email         String?
  cell          String?
  telephone     String?
  rrn           String? //rijksregisternummer
  username      String?
  firstname     String
  lastname      String
  nationality   String?
  gender        String?
  birthdate     DateTime?
  aCardNumber   String?
  sequenceNumber  Int @unique
  nameParent    String?
  cellParent    String?

  professionStatus Status?
  education     String?
  motherTongue  String?
  vt            Boolean?

  computer      Boolean?
  internet      Boolean?
  smartphone    Boolean?
  tablet        Boolean?
  notifications Boolean?
  notificationChannel String?
  attendance    Float?
  yearlyCheck   Boolean? @default(false)
  suspended     Boolean? @default(false)
  warned        Boolean? @default(false)

  address       CustomerAddress?
  organisation  Organisation
  domain        Domain?
  notes         Note[] @relation(onDelete: CASCADE)
  registrations Registration[] @relation(onDelete: CASCADE)
  applicants    Applicant[] @relation(onDelete: CASCADE)
  visits        Visit[] @relation(onDelete: CASCADE)
  attendances   Attendance[] @relation(onDelete: CASCADE)
  emailTasks    EmailTask[]
  smsTasks      SmsTask[]

  deleted       Boolean @default(false)
}

model CustomerAddress {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  street        String?
  number        String?
  bus           String?
  zip           String?
  city          String?
  country       String?

  domain        Domain?
  organisation  Organisation?
  customer      Customer

  deleted       Boolean @default(false)
}

enum Status {
    CIVIL_SERVANT
    STAMPING_JOB_SEEKER
    SOCIAL_EMPLOYMENT
    REGULAR_EMPLOYMENT
    LIVING_WAGE
    SICKNESS_INVALIDITY_ALLOWANCE
    BRIDGE_RETIRED
    RETIRED
    UNEMPLOYED
    STUDENT
    ARTICLE60
}

model Admin {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  customer      Customer
  organisation  Organisation?
  domain        Domain?

  deleted       Boolean @default(false)
}

model Note {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  type          NoteType
  text          String
  date          DateTime
  validUntil    DateTime

  location      Location?
  customer      Customer
  organisation  Organisation?
  domain        Domain?

  deleted       Boolean @default(false)
}

enum NoteType {
  INFO
  WARNING
  EXPELL
}

model Registration {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  confirmed     Boolean? @default(false)
  canceled      Boolean? @default(false)
  paid          Boolean @default(false)
  note          String? 

  customer      Customer
  activity      Activity
  domain        Domain?
  organisation  Organisation?
  department    Department?

  deleted       Boolean @default(false)
}

model Activity {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  name          String
  abbreviation  String
  courseNumber  Int
  content       String
  remark        String?
  publicNote    String?

  price         Float
  priceVT       Float?
  priceAnt      Float? // Prijs niet antwerpenaar
  priceType     PriceType  // price per unit (dus per les of activiteit)
  
  minParticipants Int
  maxParticipants Int
  
  canceled      Boolean @default(false)
  notifyOnCancel Boolean @default(true)

  published     Boolean @default(false)
  publicationTime DateTime?

  activityType  ActivityType
  notifications Notification[]
  organisation  Organisation?
  registrations Registration[] @relation(onDelete: CASCADE)
  lessons       Lesson[] @relation(onDelete: CASCADE)
  domain        Domain?
  department    Department

  deleted       Boolean @default(false)
}

model Tag {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  name          String
  content       String

  activities    Activity[]
  templates     Template[]

  organisation  Organisation
  domain        Domain?

  deleted       Boolean @default(false)
}

model ActivityType {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  name          String
  tags          Tag[]
  applicants    Applicant[]
  activities    Activity[]
  templates     Template[]

  organisation  Organisation
  domain        Domain?
  deleted       Boolean @default(false)
}

enum PriceType {
    ACTIVITY
    LESSON
}

model Lesson {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  start         DateTime
  end           DateTime

  activity      Activity?
  classroom     Classroom?
  teachers      Teacher[]
  domain        Domain?
  organisation  Organisation?
  department    Department?
  canceled      Boolean @default(false)
  notifyOnCancel Boolean @default(true)
  attendances   Attendance[] @relation(onDelete: CASCADE)

  deleted       Boolean @default(false)
}

model Attendance {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  present       Boolean @default(false)
  paid          Boolean @default(false)

  lesson        Lesson
  customer      Customer
  domain        Domain?
  organisation  Organisation?
  department    Department?

  deleted       Boolean @default(false)
}

model Teacher {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt
  
  firstname     String
  lastname      String
  email         String?
  mobile        String?

  lessons       Lesson[]
  domain        Domain?
  organisation  Organisation?
  department    Department?

  deleted       Boolean @default(false)
}

model Template {
  id                String   @default(cuid()) @id
  createdAt         DateTime @default(now())
  updatedAt         DateTime @updatedAt

  name          String
  abbreviation  String
  content       String
  tags          Tag[]
  remark        String?
  publicNote    String?
  
  price         Float
  priceVT       Float?
  priceAnt       Float? // Prijs niet antwerpenaar
  priceType     PriceType // price per unit (dus per les of activiteit)
  
  minParticipants Int
  maxParticipants Int
  
  canceled      Boolean @default(false)
  notifyOnCancel Boolean @default(true)

  published     Boolean @default(false)
  publicationTime DateTime?

  activityType  ActivityType
  notifications Notification[]
  organisation  Organisation?
  domain        Domain?
  department    Department

  deleted       Boolean @default(false)
}

model NotificationTemplate {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  message       String
  subject         String?
  event         NotificationEvent
  channel       ChannelType

  template      Template
  domain        Domain?
  organisation  Organisation?

  deleted       Boolean @default(false)
}

model Notification {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  message       String
  subject       String?
  event         NotificationEvent
  channel       ChannelType

  activity      Activity
  domain        Domain?
  organisation  Organisation?
  department    Department?

  deleted       Boolean @default(false)
}

enum ChannelType {
    EMAIL
    SMS
}

enum NotificationEvent {
    REMINDER
    CONFIRMATION
    ACTIVITY_CANCELED
    LESSON_CANCELED
}

model Applicant {
  id            String   @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  activityType  ActivityType
  customer      Customer
  domain        Domain?
  organisation  Organisation?

  deleted       Boolean @default(false)
}

model MasterNode {
  id            String @id
  pid           Int
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt
  changedAt     DateTime @default(now())
}

model EmailTask {
  id            String @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt
  reference     String?
  subject       String
  message       String
  recipients    Customer[]
  cachedStatus  String?

  organisation  Organisation
  domain        Domain?

  deleted       Boolean @default(false)
}

model SmsTask {
  id            String @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt
  reference     String?
  message       String
  recipients    Customer[]
  cachedStatus  String?

  organisation  Organisation
  domain        Domain?

  deleted       Boolean @default(false)
}

model OpeningSlot {
  id            String @default(cuid()) @id
  createdAt     DateTime @default(now())
  updatedAt     DateTime @updatedAt

  note          String?
  days          Day[]
  start         String
  end           String
  location      Location

  organisation  Organisation?
  domain        Domain?
  department    Department

  deleted       Boolean @default(false)
}

enum Day {
  MA
  DI
  WO
  DO
  VR
  ZA
  ZO
}