Error parsing attribute "@default": The function `auto` is not a known function.
See original GitHub issueHi 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:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it worked, I was using an older version. Thank You
Sorry for replying to this but, I’m starting to have this issue. After using auto() I get the same error this thread is titled as.