Skip to content

auth() couldn't find the field defined in the abstract base model #1179

@jiashengguo

Description

@jiashengguo
abstract model Base {
  id String @id @default(uuid())
}

model User extends Base {
  email String
  posts Post[]
  @@allow('all', auth() == this)
}

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

  user User @relation(fields: [userId], references: [id])
  userId String
  @@allow('all', auth().id == userId)
}

It will shows error:
Could not resolve reference to DataModelField named 'id'.zmodel(linking-error)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions