P
Prisma3mo ago
.s3nkwr

Error with correct Model

I getting as problem in IDETS2353: Object literal may only specify known properties, and 'canal' does not exist in type 'PostSelect<DefaultArgs>' and error (it's lower)
// My piece of code
const customId = "15"

const post = await prisma.post.update({
where: { id: Number(customId)},
data: {
canal: "announcements" // because I thought it wouldn't work because `channel` is reserved, but it still didn't work.
},
select: {
published: true,
content: true,
authorId: true,
authorName: true,
image: true,
id: true,
canal: true
},
})

// And model in schema.prisma
model Post {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
content String? @db.VarChar(1500)
canal String @default("no")
image String? @db.VarChar(1500)
published Boolean @default(false)
authorUrl String @default("no") @db.VarChar(500)
authorId String? @db.VarChar(1500)
authorName String @db.VarChar(1500)
}
// My piece of code
const customId = "15"

const post = await prisma.post.update({
where: { id: Number(customId)},
data: {
canal: "announcements" // because I thought it wouldn't work because `channel` is reserved, but it still didn't work.
},
select: {
published: true,
content: true,
authorId: true,
authorName: true,
image: true,
id: true,
canal: true
},
})

// And model in schema.prisma
model Post {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
content String? @db.VarChar(1500)
canal String @default("no")
image String? @db.VarChar(1500)
published Boolean @default(false)
authorUrl String @default("no") @db.VarChar(500)
authorId String? @db.VarChar(1500)
authorName String @db.VarChar(1500)
}
and my error (unrelated to discordx and discordjs):
PrismaClientValidationError:
Invalid `prisma.post.update()` invocation:

{
where: {
id: 15
},
data: {
canal: "announcements",
~~~~~
? createdAt?: DateTime | DateTimeFieldUpdateOperationsInput,
? content?: String | NullableStringFieldUpdateOperationsInput | Null,
? image?: String | NullableStringFieldUpdateOperationsInput | Null,
? published?: Boolean | BoolFieldUpdateOperationsInput,
? authorUrl?: String | StringFieldUpdateOperationsInput,
? authorId?: String | NullableStringFieldUpdateOperationsInput | Null,
? authorName?: String | StringFieldUpdateOperationsInput
},
select: {
published: true,
content: true,
authorId: true,
authorName: true,
image: true,
id: true,
canal: true
}
}

Unknown argument `canal`. Available options are marked with ?.
at Tn (D:\IDE\OTL\test_bot\node_modules\@prisma\client\runtime\library.js:115:6855)
at In.handleRequestError (D:\IDE\OTL\test_bot\node_modules\@prisma\client\runtime\library.js:122:6510)
at In.handleAndLogRequestError (D:\IDE\OTL\test_bot\node_modules\@prisma\client\runtime\library.js:122:6188)
at In.request (D:\IDE\OTL\test_bot\node_modules\@prisma\client\runtime\library.js:122:5896)
at async l (D:\IDE\OTL\test_bot\node_modules\@prisma\client\runtime\library.js:127:11167)
at async eventsButtons.handler_channelSelect (file:///D:/IDE/OTL/test_bot/src/other/events/eventsButtons.ts:77:22)
` at async next (file:///D:/IDE/OTL/test_bot/node_modules/discordx/dist/index.mjs:1116:15)`
at async Promise.all (index 0)
at async _Client.executeComponent (file:///D:/IDE/OTL/test_bot/node_modules/discordx/dist/index.mjs:806:21) {
clientVersion: '5.13.0'
}
PrismaClientValidationError:
Invalid `prisma.post.update()` invocation:

{
where: {
id: 15
},
data: {
canal: "announcements",
~~~~~
? createdAt?: DateTime | DateTimeFieldUpdateOperationsInput,
? content?: String | NullableStringFieldUpdateOperationsInput | Null,
? image?: String | NullableStringFieldUpdateOperationsInput | Null,
? published?: Boolean | BoolFieldUpdateOperationsInput,
? authorUrl?: String | StringFieldUpdateOperationsInput,
? authorId?: String | NullableStringFieldUpdateOperationsInput | Null,
? authorName?: String | StringFieldUpdateOperationsInput
},
select: {
published: true,
content: true,
authorId: true,
authorName: true,
image: true,
id: true,
canal: true
}
}

Unknown argument `canal`. Available options are marked with ?.
at Tn (D:\IDE\OTL\test_bot\node_modules\@prisma\client\runtime\library.js:115:6855)
at In.handleRequestError (D:\IDE\OTL\test_bot\node_modules\@prisma\client\runtime\library.js:122:6510)
at In.handleAndLogRequestError (D:\IDE\OTL\test_bot\node_modules\@prisma\client\runtime\library.js:122:6188)
at In.request (D:\IDE\OTL\test_bot\node_modules\@prisma\client\runtime\library.js:122:5896)
at async l (D:\IDE\OTL\test_bot\node_modules\@prisma\client\runtime\library.js:127:11167)
at async eventsButtons.handler_channelSelect (file:///D:/IDE/OTL/test_bot/src/other/events/eventsButtons.ts:77:22)
` at async next (file:///D:/IDE/OTL/test_bot/node_modules/discordx/dist/index.mjs:1116:15)`
at async Promise.all (index 0)
at async _Client.executeComponent (file:///D:/IDE/OTL/test_bot/node_modules/discordx/dist/index.mjs:806:21) {
clientVersion: '5.13.0'
}
I don't know how to fix this because i started using Prisma a day before yesterday but i checked all and ran commands prisma generate & prisma db push PS: in database canal field appeared Prisma version: 5.13.0
Solution:
i just had output in my scheme
No description
Jump to solution
7 Replies
RaphaelEtim
RaphaelEtim3mo ago
Hi @s3nkwr How are you using the type PostSelect<DefaultArgs> in your code?
.s3nkwr
.s3nkwr3mo ago
post?.canal? Or is this not it?
RaphaelEtim
RaphaelEtim3mo ago
No it isn't. I mean did you use the type PostSelect<DefaultArgs> anywhere in your code.
.s3nkwr
.s3nkwr3mo ago
no
RaphaelEtim
RaphaelEtim3mo ago
can you share the repository so i can take a look?
.s3nkwr
.s3nkwr3mo ago
ok i fixed this
Solution
.s3nkwr
.s3nkwr3mo ago
i just had output in my scheme
No description