.transaction([]) fails with Request Timeout Error on large dataset
See original GitHub issueBug description
I get this error in v2.8.1
_p [Error]:
Invalid `prisma.injection.upsert()` invocation in
webpack-internal:///./src/pages/api/injection/index.ts:191:79
Request Timeout Error
at Jw.request (/Users/user/project/node_modules/@prisma/client/runtime/index.js:210:54)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
code: 'UND_ERR_REQUEST_TIMEOUT',
meta: undefined
}
{
"code": "UND_ERR_REQUEST_TIMEOUT"
}
if I use prisma.$transation
on a large dataset (25k) and if i use Promise.all
on the same dataset it works.
How to reproduce
const businesses= await prisma.business.findMany({
where: { businessOptions: { some: { isSelected: true } } },
// take: 10,
include: {
businessOptions: { where: { isSelected: true }, include: { directory: true } },
},
});
const operations = prisma.map(({ ...data }) =>
prisma.injection.upsert({
where: { id: data.id },
create: { ...data, business: { connect: { id: data.id } } },
update: {
...data,
},
}),
);
await appClient.$transaction(operations);
Expected behavior
Not throwing error when using prisma.$transation
on a large dataset
Prisma information
Environment & setup
- OS: Macos
- Database: PostgresSQL 12
- Node.js version: 12
- Prisma version: 2.8.1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Database maintenance fails throwing a timeout error
In large databases this may be a possible cause. Method 1: Add a Connection Timeout attribute to the connectionString in the DataConfig file...
Read more >Troubleshoot query time-out errors - SQL Server
This article describes how to troubleshoot the time-out errors when you run slow-running queries.
Read more >How to Fix a Lock Wait Timeout Exceeded Error in MySQL
The above simply means the transaction has reached the innodb_lock_wait_timeout while waiting to obtain an exclusive lock which defaults to 50 ...
Read more >c# - Timeout exception even after setting timeout property for ...
The transaction log for my database is full. void Dump() { using (SqlConnection connection = new SqlConnection(connectionString)) { connection.
Read more >Troubleshooting import failures during connector imports ... - IBM
By default, transaction timeout is set at two hours. The import can fail if that time exceeds. This error can also occur due...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey guys. Just curious for planning purposes on our side… is there currently any idea when this issue might be getting looked at (and worked on)? Not being able to do large bulk inserts is actually a pretty significant blocker on our end that can’t wait too much longer and our only temporary fix appears to be reverting back to 1.5.1 (pretty sure that was the last version that worked) and then undo our usage of several features that came in releases after that (which wouldn’t be a trivial amount of work at this point).
I completely understand that you guys obviously have to favor your own business priorities. I’m just trying to figure out if this is days, weeks, or months away. Because if it’s on the longer side, I’m going to have to revert a lot of updates on our side and go back to an older version of Prisma so we can get things working. In the spirit of supporting open source projects that I depend on (and really love working with!), I’m also happy to figure it out and submit a PR if that makes sense. But I suspect that someone more familiar with the inner workings of Prisma would be a better/faster option.
Let me know what you guys are thinking and I’ll do whatever I have to on my side. Thanks!
Yes, 2.11 removed timeouts from undici via https://github.com/prisma/prisma/pull/4156 so this is fixed in 2.11