Open Aarav-Juneja opened 1 month ago
Got the same issue. Here are the details:
schema.prisma
:
datasource db {
provider = "sqlite"
url = "file:./dev.db?connection_limit=2"
}
journal_mode
is set to WAL
.
PrismaServiceOptions:
createPrismaOptions(): Promise<PrismaServiceOptions> | PrismaServiceOptions {
return {
prismaOptions: {
log: ['info'],
transactionOptions: {
maxWait: 5000,
timeout: 10000,
isolationLevel: Prisma.TransactionIsolationLevel.Serializable,
}
},
}
}
return await this.prisma.print_order.update({
where: {
print_id: printOrder.printId,
},
data: {
is_printed: printOrder.isPrinted,
failure_reason: printOrder.failureReason,
},
});
30/09/2024, 17:51:07: error "Query print_order.update failed:
Invalid 'this.prisma.print_order.update()' invocation
in \nC:\Users\XX\AppData\Local\XXXXXXXXXXXXXXXXXXXXXXX\app-
1.0.25\resources\app\nestjs-server\dist\print-order\print-
order.service.js:51:46\n 48 async updatePrintOrder(message) {n 49 const
printOrder = message.payload;n 50
this.checkPrintOrderUpdatePayload(printOrder);\n 51 return await
this.prisma.print_order.update()\nOperations timed out after 'N/A'. Context: The
database failed to respond to a query within the configured timeout — see
https://pris.ly/d/sqlite-connector for more details. Database:
C:\Users\XX\AppData\Local\XXXXXXXXXXXXXXXXXXXXXXX\app-
1.0.25\resources\app\nestjs-server\prisma\dev.db"
OS: Windows 10
Prisma version: 5.19.1
I am not using Promise.all
anywhere in my code. This error happens randomly. I'll try to use this url = "file:./dev.db?connection_limit=2&socket_timeout=10"
in schema.prisma
to see if it solves the issue. The default timeout if 5 seconds. And, there is nothing in my application that would lock the database for even 5 seconds.
@Aarav-Juneja Can you try the following in your schema.prisma
file?
datasource db {
provider = "sqlite"
url = "file:./dev.db?connection_limit=1&socket_timeout=10"
}
Does this solve your problem?
Bug description
When running a large number of update operations >1500, the operation times out. I'm using
Promise.all
, and the queries are being resolved quite quickly, but it still times out.Here's the error:
I have the code below, and it only seems to be erroring out when I keep the find operation, and if I use a static value, the query is able to execute correctly. I suspect that's just because static values resolve in under the timeout.
How to reproduce
Use the code, schema, and json format I have provided. The code will timeout after time
M/A
Expected behavior
All queries should work and there should be no timeout for database operations, especially large ones.
Prisma information
The json file has 1600 values with the format:
Environment & setup
Prisma Version