Console prisma studio
Hello, when I run prisma studio locally everything is fine, but in the prisma studio console I get this error. Is it a bug in the console or on my side?
I get this error even with an empty database, I have asked AI and tried many different configs.... nothing helps
installHook.js:1 Error: {"error_code":"P1012","message":"\u001b[1;91merror\u001b[0m: \u001b[1mError validating: This line is not a valid field or attribute definition.\u001b[0m\n \u001b[1;94m-->\u001b[0m \u001b[4mschema.prisma:57\u001b[0m\n\u001b[1;94m | \u001b[0m\n\u001b[1;94m56 | \u001b[0mmodel Staff {\n\u001b[1;94m57 | \u001b[0m \u001b[1;91mid Int @id(map: "Staff_pkey") @default(nextval('staff_id_seq")\u001b[0m\n\u001b[1;94m58 | \u001b[0m name String\n\u001b[1;94m | \u001b[0m\n\u001b[1;91merror\u001b[0m: \u001b[1mError validating: This line is not a valid field or attribute definition.\u001b[0m\n \u001b[1;94m-->\u001b[0m \u001b[4mschema.prisma:67\u001b[0m\n\u001b[1;94m | \u001b[0m\n\u001b[1;94m66 | \u001b[0mmodel Studio {\n\u001b[1;94m67 | \u001b[0m \u001b[1;91mid Int @id(map: "Studio_pkey") @default(nextval('studio_id_seq")\u001b[0m\n\u001b[1;94m68 | \u001b[0m name String\n\u001b[1;94m | \u001b[0m\n\nValidation Error Count: 2"}
17 Replies
You decided to hold for human wisdom. We'll chime in soon! Meanwhile,
#ask-ai
is there if you need a quick second opinion.Hi @Kasmadan (UA)
Thank you for raising this. I'm taking a look at will provide updates shortly.
Hi @Kasmadan (UA)
Can you please share the relevant parts of your schema so i can reproduce using it using that given that Prisma Studion in console works fine for me at the moment.
Hi, @RaphaelEtim this is my models
model Booking {
id String @id @default(cuid())
status BookingStatus @default(CREATED)
phone String
userEmail String
staffId Int
recordId Int @unique
studioId Int
resourceId Int
servicesCount Int
seanceLength Int
startDate DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userEmail], references: [email], onDelete: Cascade)
staff Staff @relation(fields: [staffId], references: [staffId])
studio Studio @relation(fields: [studioId], references: [studioId])
@@index([id, recordId, userEmail])
}
model Staff {
id Int @id @default(autoincrement())
name String
avatar String
staffId Int @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
bookings Booking[]
@@index([id])
}
model Studio {
id Int @id @default(autoincrement())
name String
city String
country String
address String
schedule String
studioId Int @unique
latitude Float
longitude Float
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// users User[]
bookings Booking[]
@@index([id])
}
enum BookingStatus {
UPDATED
CREATED
CANCELED
}
And what I currently have in console
installHook.js:1 Error: {"error_code":"P1012","message":"\u001b[1;91merror\u001b[0m: \u001b[1mError parsing attribute "@relation": A one-to-one relation must use unique fields on the defining side. Either add an
@unique
attribute to the field staffId
, or change the relation to one-to-many.\u001b[0m\n \u001b[1;94m-->\u001b[0m \u001b[4mschema.prisma:36\u001b[0m\n\u001b[1;94m | \u001b[0m\n\u001b[1;94m35 | \u001b[0m userEmail String\n\u001b[1;94m36 | \u001b[0m \u001b[1;91mstaff Staff @relation("Booking_staffId_fkey", fields: [staffId], references: [staffId], map: "Booking_staffId_fkey")\u001b[0m\n\u001b[1;94m37 | \u001b[0m staffId Int\n\u001b[1;94m | \u001b[0m\n\u001b[1;91merror\u001b[0m: \u001b[1mError parsing attribute "@relation": A one-to-one relation must use unique fields on the defining side. Either add an @unique
attribute to the field studioId
, or change the relation to one-to-many.\u001b[0m\n \u001b[1;94m-->\u001b[0m \u001b[4mschema.prisma:39\u001b[0m\n\u001b[1;94m | \u001b[0m\n\u001b[1;94m38 | \u001b[0m recordId Int @unique(map: "Booking_recordId_key")\n\u001b[1;94m39 | \u001b[0m \u001b[1;91mstudio Studio @relation("Booking_studioId_fkey", fields: [studioId], references: [studioId], map: "Booking_studioId_fkey")\u001b[0m\n\u001b[1;94m40 | \u001b[0m studioId Int\n\u001b[1;94m | \u001b[0m\n\nValidation Error Count: 2"}
@RaphaelEtim if you need something else I will provide
Thanks for providing more information. I’ll take a look at get back to you
@RaphaelEtim Hi, I'd like to ask about the progress :prismasmile:
Hi @Kasmadan (UA)
I appreciate your patience. I can reproduce the exact scenario you have. The record works correctly in the local studio instance but fails when used in studio on the console. I'm sharing this with the team for investigations.
@RaphaelEtim
Thanks!
@RaphaelEtim After maintenance, I can see the UI, but I still get the error
Message: Malformed response from Prisma Client:
null
Query: { "modelName": "Account", "operation": "findMany", "args": { "take": 100, "skip": 0, "select": { "user": true, "userId": true, "type": true, "provider": true, "providerAccountId": true, "refreshToken": true, "accessToken": true, "expiresAt": true, "tokenType": true, "scope": true, "idToken": true, "sessionState": true, "createdAt": true, "updatedAt": true } } }
Query: { "modelName": "Account", "operation": "findMany", "args": { "take": 100, "skip": 0, "select": { "user": true, "userId": true, "type": true, "provider": true, "providerAccountId": true, "refreshToken": true, "accessToken": true, "expiresAt": true, "tokenType": true, "scope": true, "idToken": true, "sessionState": true, "createdAt": true, "updatedAt": true } } }
Hi @Kasmadan (UA), The fix for this issue has not been rolled out yet. Once it's done, i'll inform you.
okay, thanks
@RaphaelEtim I have been asked to find out when to expect a fix? Really need the ability to manage tables in prod...
Hi @Kasmadan (UA), I can confirm that this has been fixed. Can you please try again and let us know if you run into any issues?
@RaphaelEtim
Hmm, I see that the tables that are user related have this problem
Message: Malformed response from Prisma Client:
null
Query: { "modelName": "User", "operation": "findMany", "args": { "take": 100, "skip": 0, "select": { "id": true, "name": true, "email": true, "emailVerified": true, "image": true, "phone": true, "studioId": true, "countryAId": true, "countryName": true, "countryCode": true, "messenger": true, "birthDate": true, "gender": true, "language": true, "role": true, "customerType": true, "createdAt": true, "updatedAt": true, "accounts": true, "sessions": { "select": { "id": true } }, "verificationTokens": true, "bookings": { "select": { "id": true } }, "visitFeedbacks": { "select": { "id": true } } } } } if no relation with User than all is okay, but I have only 1 table wo User ralation 🙂 locally all tables work fine
Query: { "modelName": "User", "operation": "findMany", "args": { "take": 100, "skip": 0, "select": { "id": true, "name": true, "email": true, "emailVerified": true, "image": true, "phone": true, "studioId": true, "countryAId": true, "countryName": true, "countryCode": true, "messenger": true, "birthDate": true, "gender": true, "language": true, "role": true, "customerType": true, "createdAt": true, "updatedAt": true, "accounts": true, "sessions": { "select": { "id": true } }, "verificationTokens": true, "bookings": { "select": { "id": true } }, "visitFeedbacks": { "select": { "id": true } } } } } if no relation with User than all is okay, but I have only 1 table wo User ralation 🙂 locally all tables work fine
Can you please share the User model ? The previous schema you shared didn’t have the User model included.
yes
@RaphaelEtim
@RaphaelEtim another one, after new build I got this
installHook.js:1 Error: {"error_code":"P1012","message":"\u001b[1;91merror\u001b[0m: \u001b[1mError validating: This line is not a valid field or attribute definition.\u001b[0m\n \u001b[1;94m-->\u001b[0m \u001b[4mschema.prisma:136\u001b[0m\n\u001b[1;94m | \u001b[0m\n\u001b[1;94m135 | \u001b[0m updatedAt DateTime @updatedAt\n\u001b[1;94m136 | \u001b[0m \u001b[1;91mnotificationsAllowed Unsupported("_NotificationsAllowed")? @default(ARRAY['GOOGLE_MAP_FEEDBACK'::"NotificationsAllowed", 'SYSTEM_EMAILS'::"NotificationsAllowed", 'INFO_EMAILS'::"NotificationsAllowed", 'NEWS_EMAILS'::"NotificationsAllowed", 'FEEDBACK_EMAILS)\u001b[0m\n\u001b[1;94m137 | \u001b[0m accounts Account[] @relation("Account_userId_fkey")\n\u001b[1;94m | \u001b[0m\n\nValidation Error Count: 1"}
at be (route-CbG9wzOF.js:2:8086)
at prisma_schema_build.wasm.get_dmmf (prisma_schema_build.wasm-00aaae5a:0xc5dda)
at O (route-CbG9wzOF.js:2:4553)
at Se (route-CbG9wzOF.js:2:8969)
at async Ee.getDMMF (route-CbG9wzOF.js:2:9192)
at async Object.request (index-CkpF8L1q.js:1555:2680)
at async Zm.init (index-CkpF8L1q.js:1588:50115)
at async qL (index-CkpF8L1q.js:1608:43057)
I added new field to User model
notificationsAllowed NotificationsAllowed[] @default([GOOGLE_MAP_FEEDBACK, SYSTEM_EMAILS, INFO_EMAILS, NEWS_EMAILS, FEEDBACK_EMAILS])
enum NotificationsAllowed {
INFO_EMAILS
NEWS_EMAILS
SYSTEM_EMAILS
FEEDBACK_EMAILS
GOOGLE_MAP_FEEDBACK
}
Thanks for sharing the schema. I can also reproduce this error and have shared it with the team for further investigation.