Seba
PPrisma
•Created by Seba on 1/10/2025 in #help-and-questions
PrismaClientValidationError
Hello there, I'm currently stuck with this error:
./src/lib/server/ticket.ts:
Does anyone know how to solve this?
Invalid `prisma.ticket.create()` invocation in
./src/lib/server/ticket.ts:12:16
9 phone_number: string,
10 userId?: number
11 ) =>
→ 12 prisma.ticket.create({
data: {
title: "Title",
description: "Description",
createdBy: {
connect: undefined
},
info: {
connectOrCreate: {
where: {
userId: undefined,
name: "name",
surname: "surname",
email: "email",
phone_number: "tel",
? id?: Int,
? name_surname_phone_number_email?: InformationNameSurnamePhone_numberEmailCompoundUniqueInput,
? AND?: InformationWhereInput | InformationWhereInput[],
? OR?: InformationWhereInput[],
? NOT?: InformationWhereInput | InformationWhereInput[],
? users?: UserNullableScalarRelationFilter | UserWhereInput | Null,
? tickets?: TicketListRelationFilter
},
create: {
name: "name",
surname: "surname",
email: "email",
phone_number: "tel"
}
}
}
}
})
Argument `where` of type InformationWhereUniqueInput needs at least one of `id`, `userId` or `name_surname_phone_number_email` arguments. Available options are marked with ?.
clientVersion: '6.2.1'
Node.js v22.11.0
Invalid `prisma.ticket.create()` invocation in
./src/lib/server/ticket.ts:12:16
9 phone_number: string,
10 userId?: number
11 ) =>
→ 12 prisma.ticket.create({
data: {
title: "Title",
description: "Description",
createdBy: {
connect: undefined
},
info: {
connectOrCreate: {
where: {
userId: undefined,
name: "name",
surname: "surname",
email: "email",
phone_number: "tel",
? id?: Int,
? name_surname_phone_number_email?: InformationNameSurnamePhone_numberEmailCompoundUniqueInput,
? AND?: InformationWhereInput | InformationWhereInput[],
? OR?: InformationWhereInput[],
? NOT?: InformationWhereInput | InformationWhereInput[],
? users?: UserNullableScalarRelationFilter | UserWhereInput | Null,
? tickets?: TicketListRelationFilter
},
create: {
name: "name",
surname: "surname",
email: "email",
phone_number: "tel"
}
}
}
}
})
Argument `where` of type InformationWhereUniqueInput needs at least one of `id`, `userId` or `name_surname_phone_number_email` arguments. Available options are marked with ?.
clientVersion: '6.2.1'
Node.js v22.11.0
export const createTicket = (title: string, description: string, name: string, surname: string, email: string, phone_number: string, userId?: number) => prisma.ticket.create({
data: {
title,
description,
createdBy: { connect: userId ? { id: userId } : undefined },
info: { connectOrCreate: { where: { userId, name, surname, email, phone_number }, create: { name, surname, email, phone_number } } }
}
});
export const createTicket = (title: string, description: string, name: string, surname: string, email: string, phone_number: string, userId?: number) => prisma.ticket.create({
data: {
title,
description,
createdBy: { connect: userId ? { id: userId } : undefined },
info: { connectOrCreate: { where: { userId, name, surname, email, phone_number }, create: { name, surname, email, phone_number } } }
}
});
9 replies