P
Prisma3mo ago
Fırat

Prisma does nothing unless we use await

Hello. I don't use await when doing update() in Prisma because I don't want to wait. However, when I do this, Prisma doesn't perform the update.
3 Replies
Prisma AI Help
Prisma AI Help3mo ago
You selected to wait for the human sages. They'll share their wisdom soon. Grab some tea while you wait, or check out #ask-ai if you'd like a quick chat with the bot anyway!
Nurul
Nurul2mo ago
This is expected behavior in Prisma. Prisma Client operations like update() are "lazy" and will only execute if you either use await, chain them with .then(), or otherwise handle the returned Promise. If you simply call update() without awaiting or chaining, the query will not be sent to the database and no update will occur.
Fırat
FıratOP2mo ago
I don't think this makes sense, because someone unaware of it would realize too late that an operation that shouldn't have been expected didn't occur. This is designed to keep the query pending for those who want to run it later, but they could do it differently. It's very confusing.

Did you find this page helpful?