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.

TypeError: Cannot read property 'name' of undefined

See original GitHub issue

Hi,

I was trying to test it against my prisma schema und I got this error.

TypeError: Cannot read property 'name' of undefined
    at joinField (node_modules/prisma-dbml-generator/dist/generator/many-to-many-tables.js:27:23)
    at /node_modules/prisma-dbml-generator/dist/generator/many-to-many-tables.js:24:33

I can share the schema, if it’s important.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
omarkhatibcocommented, Jun 8, 2021

@marcjulian, thanks for your help !

1reaction
omarkhatibcocommented, Jun 4, 2021

Hi @marcjulian

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

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

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["nApi", "selectRelationCount", "filterJson"]
}

generator nestgraphql {
  provider = "node node_modules/prisma-nestjs-graphql"
  output   = "../src/@generated/"
  reExport = All
}

generator dbml {
  provider = "prisma-dbml-generator"
}

generator docs {
  provider = "node node_modules/prisma-docs-generator"
}

enum UserStatus {
  ACTIVE
  FUTURUSER
  INACTIVE
  INVITED
}

enum FriendshipStatus {
  REQUESTED
  ACCEPTED
  REJECTED
}

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

  // Auth Fields
  mobileNumber String  @unique
  email        String  @unique
  /// @HideField({ output: true, input: true })
  pin          String?

  // Personal Information
  firstName String?
  lastName  String?
  birthday  DateTime?


  // System Data
  status    UserStatus @default(INACTIVE)
  createdAt DateTime   @default(now())
  updatedAt DateTime   @updatedAt

  //Associated Profile
  profile Profile?

  //Associated Image
  profileImage UserFile?


  //Friends - relations n-m
  friends  User[] @relation("UserFriendsUser", references: [id])
  friendOf User[] @relation("UserFriendsUser", references: [id])

  //FriendsRequest
  sentFriendsRequest     FriendRequest[] @relation("UserSendsFriendRequest")
  receivesFriendsRequest FriendRequest[] @relation("UserReceivesFriendRequest")

  //parent and child for FUTURE USER
  parent   User?   @relation("UserParentOfUser", fields: [parentId], references: [id])
  children User[]  @relation("UserParentOfUser")
  parentId String?

  // Associated Posts - relations 1-n
  posts         Post[] @relation("UserAuthorsPost")
  receivedPosts Post[] @relation("userReceivesPosts")

  // Comments
  comments Comment[]

  // created Moods
  moods Mood[]

}

model FriendRequest {
  user     User             @relation("UserSendsFriendRequest", fields: [userId], references: [id])
  userId   String
  friend   User             @relation("UserReceivesFriendRequest", fields: [userId], references: [id])
  friendId String
  status   FriendshipStatus

  @@id([userId, friendId])
}

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

  // notification Settings
  notificationStatus    Boolean?  @default(true)
  notificationStartTime DateTime?
  notificationEndTme    DateTime?

  //Extras
  tos       DateTime @default(now())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  // Relations
  user   User   @relation(fields: [userId], references: [id])
  userId String @unique

  currentMode   Mood?   @relation(fields: [currentModeId], references: [id])
  currentModeId String?

}

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

  // Type - Content
  content  String?
  location Json?
  youtube  String[]
  spotify  String[]

  // Type - Media
  media PostFile[]


  // Extras
  publishedAt DateTime
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt

  // relations with User
  author     User   @relation("UserAuthorsPost", references: [id], fields: [authorId])
  authorId   String
  receivedBy User[] @relation("userReceivesPosts", references: [id])

  // Publish Options
  receivedAt     DateTime?
  receivedMood   Mood?     @relation(fields: [receivedMoodId], references: [id])
  receivedMoodId String?

  // comments
  comments Comment[]

}

model Comment {
  id      String @id @default(cuid())
  // Type - Content
  content String

  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt


  //ParentPost
  post   Post   @relation(fields: [postId], references: [id])
  postId String

  // Comments
  parentComment    Comment?  @relation("CommentToComment", fields: [parentCommentId], references: [id])
  childrenComments Comment[] @relation("CommentToComment")
  parentCommentId  String?

  // Author
  author   User   @relation(references: [id], fields: [authorId])
  authorId String
}

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

  // Data
  name String

  //Extras
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  author   User?   @relation(fields: [authorId], references: [id])
  authorId String?

  // connection to mood
  profiles Profile[]
  posts    Post[]
}

model PostFile {
  id  String @id
  url String

  post   Post   @relation(fields: [postId], references: [id])
  postId String
}

model UserFile {
  id  String @id
  url String

  user   User   @relation(fields: [userId], references: [id])
  userId String
}

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

}

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'name' of undefined
This type of error mean that your container variable file is not defined. You should use console.log at different places to see what...
Read more >
Uncaught TypeError: Cannot read property 'name' of undefined
It is a very common error when working with object and array to get a TypeError: Cannot read property 'name' of undefined ....
Read more >
5.2 - TypeError: Cannot read property 'name' of undefined
5.2 - loop the loop - TypeError: Cannot read property 'name' of undefined. I get an error but still get a pass. Also...
Read more >
Cannot read property 'name' of undefined' mean? - Quora
Usually it means you misspelled a variable name, or forgot to declare a variable, or it is out of scope.
Read more >
Cannot read property 'name' of undefined, at Array.forEach
TypeError : Cannot read property 'name' of undefined, at Array.forEach ... When I press the button to display the task pane, I am...
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