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.

Error parsing attribute "@default": The function `auto` is not a known function.

See original GitHub issue

Hi there, trying to follow along with the quickstart guide. When trying to generate, I get the following error using auto() for attribute @default. I switched over to uuid() and it works now, but thought this error was weird and worth looking into.

I’m using next.js v12 with Typescript on node v16

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Error: Schema parsing
error: Error parsing attribute "@default": The function `auto` is not a known function. You can read about the available functions here: https://pris.ly/d/attribute-functions.
  -->  schema.prisma:12
   | 
11 | model Project {
12 |   id       String    @id @default(auto()) @map("_id") @db.ObjectId
   | 
error: Error parsing attribute "@default": The function `auto` is not a known function. You can read about the available functions here: https://pris.ly/d/attribute-functions.
  -->  schema.prisma:24
   | 
23 | model Bug {
24 |   id          String    @id @default(auto()) @map("_id") @db.ObjectId
   | 
error: Error parsing attribute "@default": The function `auto` is not a known function. You can read about the available functions here: https://pris.ly/d/attribute-functions.
  -->  schema.prisma:32
   | 
31 | model User {
32 |   id       String    @id @default(auto()) @map("_id") @db.ObjectId
   | 

Validation Error Count: 3

schema.prisma

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

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["mongoDb"]
}

model Project {
  id       String    @id @default(auto()) @map("_id") @db.ObjectId
  slug     String    @unique
  title    String
  body     String
  bugs     Bug[]
  user     User      @relation(fields: [userId], references: [id])
  userId   String    @db.ObjectId
}

// Comments contain a comment string and connect back to the post.
// postId must have @db.ObjectId to match up with Post's id type
model Bug {
  id          String    @id @default(auto()) @map("_id") @db.ObjectId
  project     Project   @relation(fields: [projectId], references: [id])
  projectId   String    @db.ObjectId
  description String
  priority    String
}

model User {
  id       String    @id @default(auto()) @map("_id") @db.ObjectId
  email    String    @unique
  name     String?
  projects Project[]
}

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
iamshabellcommented, Apr 27, 2022

it worked, I was using an older version. Thank You

2reactions
Sukarett2commented, Feb 22, 2022

Sorry for replying to this but, I’m starting to have this issue. image After using auto() I get the same error this thread is titled as.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma with psql db - incompatible types: text and uuid
Error parsing attribute "@relation": The type of the field id in the model Request is not matching the type of the referenced field...
Read more >
error parsing attribute @relation: a one-to-one relation must ...
ObjectId | error: Error parsing attribute "@default": The function `auto` is not a known function. You can read about the available functions here: ......
Read more >
Schema Incompatibilities | PostgreSQL - Prisma
There's no DEFAULT constraint added to the database column. ... Problem. Prisma 1 auto-generates ID values as CUIDs for ID fields when they're...
Read more >
Troubleshooting CloudFormation - AWS Documentation
Delete stack fails; Dependency error; Error parsing parameter when passing ... using a service role, or if your stack contains a resource that...
Read more >
HTML Standard
This effort started with a reformulation of HTML4 in XML, known as XHTML 1.0, which added no new features except the new serialization,...
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