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 properties of undefined (reading 'dbName') version `0.10.0`

See original GitHub issue
TypeError: Cannot read properties of undefined (reading 'dbName')

schema

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

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

generator typegraphql {
  provider = "typegraphql-prisma"
}

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

model Message {
  messageId Int      @id @default(autoincrement()) @map("message_id")
  sender    String
  content   String
  timestamp DateTime @default(now())
  group     Group    @relation(fields: [groupId], references: [groupId], onDelete: Cascade)
  groupId   String
}

model Group {
  groupId  String    @id @default(uuid()) @map("group_id")
  name     String?
  messages Message[]
  app      App       @relation(fields: [appId], references: [appId], onDelete: Cascade)
  appId    String
}

model App {
  appId          String  @id @default(uuid()) @map("app_id")
  name           String  @unique
  messageCounter Int     @default(0) @map("message_counter")
  groups         Group[]
}

dataModelString

{
    "enums": [],
    "models": [
      {
        "name": "Message",
        "dbName": null,
        "fields": [
          {
            "name": "messageId",
            "kind": "scalar",
            "isList": false,
            "isRequired": true,
            "isUnique": false,
            "isId": true,
            "isReadOnly": false,
            "type": "Int",
            "hasDefaultValue": true,
            "default": {
              "name": "autoincrement",
              "args": []
            },
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "sender",
            "kind": "scalar",
            "isList": false,
            "isRequired": true,
            "isUnique": false,
            "isId": false,
            "isReadOnly": false,
            "type": "String",
            "hasDefaultValue": false,
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "content",
            "kind": "scalar",
            "isList": false,
            "isRequired": true,
            "isUnique": false,
            "isId": false,
            "isReadOnly": false,
            "type": "String",
            "hasDefaultValue": false,
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "timestamp",
            "kind": "scalar",
            "isList": false,
            "isRequired": true,
            "isUnique": false,
            "isId": false,
            "isReadOnly": false,
            "type": "DateTime",
            "hasDefaultValue": true,
            "default": {
              "name": "now",
              "args": []
            },
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "group",
            "kind": "object",
            "isList": false,
            "isRequired": true,
            "isUnique": false,
            "isId": false,
            "isReadOnly": false,
            "type": "Group",
            "hasDefaultValue": false,
            "relationName": "GroupToMessage",
            "relationFromFields": [
              "groupId"
            ],
            "relationToFields": [
              "groupId"
            ],
            "relationOnDelete": "Cascade",
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "groupId",
            "kind": "scalar",
            "isList": false,
            "isRequired": true,
            "isUnique": false,
            "isId": false,
            "isReadOnly": true,
            "type": "String",
            "hasDefaultValue": false,
            "isGenerated": false,
            "isUpdatedAt": false
          }
        ],
        "isGenerated": false,
        "primaryKey": null,
        "uniqueFields": [],
        "uniqueIndexes": []
      },
      {
        "name": "Group",
        "dbName": null,
        "fields": [
          {
            "name": "groupId",
            "kind": "scalar",
            "isList": false,
            "isRequired": true,
            "isUnique": false,
            "isId": true,
            "isReadOnly": false,
            "type": "String",
            "hasDefaultValue": true,
            "default": {
              "name": "uuid",
              "args": []
            },
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "name",
            "kind": "scalar",
            "isList": false,
            "isRequired": false,
            "isUnique": false,
            "isId": false,
            "isReadOnly": false,
            "type": "String",
            "hasDefaultValue": false,
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "messages",
            "kind": "object",
            "isList": true,
            "isRequired": true,
            "isUnique": false,
            "isId": false,
            "isReadOnly": false,
            "type": "Message",
            "hasDefaultValue": false,
            "relationName": "GroupToMessage",
            "relationFromFields": [],
            "relationToFields": [],
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "app",
            "kind": "object",
            "isList": false,
            "isRequired": true,
            "isUnique": false,
            "isId": false,
            "isReadOnly": false,
            "type": "App",
            "hasDefaultValue": false,
            "relationName": "AppToGroup",
            "relationFromFields": [
              "appId"
            ],
            "relationToFields": [
              "appId"
            ],
            "relationOnDelete": "Cascade",
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "appId",
            "kind": "scalar",
            "isList": false,
            "isRequired": true,
            "isUnique": false,
            "isId": false,
            "isReadOnly": true,
            "type": "String",
            "hasDefaultValue": false,
            "isGenerated": false,
            "isUpdatedAt": false
          }
        ],
        "isGenerated": false,
        "primaryKey": null,
        "uniqueFields": [],
        "uniqueIndexes": []
      },
      {
        "name": "App",
        "dbName": null,
        "fields": [
          {
            "name": "appId",
            "kind": "scalar",
            "isList": false,
            "isRequired": true,
            "isUnique": false,
            "isId": true,
            "isReadOnly": false,
            "type": "String",
            "hasDefaultValue": true,
            "default": {
              "name": "uuid",
              "args": []
            },
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "name",
            "kind": "scalar",
            "isList": false,
            "isRequired": true,
            "isUnique": true,
            "isId": false,
            "isReadOnly": false,
            "type": "String",
            "hasDefaultValue": false,
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "messageCounter",
            "kind": "scalar",
            "isList": false,
            "isRequired": true,
            "isUnique": false,
            "isId": false,
            "isReadOnly": false,
            "type": "Int",
            "hasDefaultValue": true,
            "default": 0.0,
            "isGenerated": false,
            "isUpdatedAt": false
          },
          {
            "name": "groups",
            "kind": "object",
            "isList": true,
            "isRequired": true,
            "isUnique": false,
            "isId": false,
            "isReadOnly": false,
            "type": "Group",
            "hasDefaultValue": false,
            "relationName": "AppToGroup",
            "relationFromFields": [],
            "relationToFields": [],
            "isGenerated": false,
            "isUpdatedAt": false
          }
        ],
        "isGenerated": false,
        "primaryKey": null,
        "uniqueFields": [],
        "uniqueIndexes": []
      }
    ]
  }

mapped models

{mappedModels: [
  {
    name: 'Message',
    dbName: null,
    fields: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
    isGenerated: false,
    primaryKey: null,
    uniqueFields: [],
    uniqueIndexes: []
  },
  {
    name: 'Group',
    dbName: null,
    fields: [ [Object], [Object], [Object], [Object], [Object] ],
    isGenerated: false,
    primaryKey: null,
    uniqueFields: [],
    uniqueIndexes: []
  },
  {
    name: 'App',
    dbName: null,
    fields: [ [Object], [Object], [Object], [Object] ],
    isGenerated: false,
    primaryKey: null,
    uniqueFields: [],
    uniqueIndexes: []
  }
]}

mentioned in #62

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
keonikcommented, Feb 24, 2022

@janpio I’m loving this debug output already 😎 Thank you

0reactions
keonikcommented, Mar 9, 2022

It ended up being an old prisma engine error. The older version I am/was using throws an error for dml.types not defaulted to an empty array. So it was pushing an undefined into the modellikes. Will be shipped here soon in 0.10.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'dbName' of null
I've tried to connect my Loopback application with MongoDb Atlas, but I'm having an error "TypeError: Cannot read property 'dbName' of null" ...
Read more >
Not working for MongoDB · Issue #62 - GitHub
When using mongodb, the erd doesn't create any relationships. ... TypeError: Cannot read properties of undefined (reading 'dbName') version ...
Read more >
TypeError: Cannot read properties of undefined ... - MongoDB
I have this code here: import { MongoClient } from "mongodb"; const createConnection = () => { // let current = null; const...
Read more >
Find Answers to AWS Questions | AWS re:Post
Browse through and find similar questions to yours or answer questions from the community to become an expert on AWS re:Post.
Read more >
Changelog - WatermelonDB documentation - GitHub Pages
Read -only records that cannot be saved in the database, updated, or deleted and only ... This is a big release to WatermelonDB...
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