AWS data api error in transactions

Basically here's the aurora issue progress: I want to run concurrent db requests(Promise.all) to aws-data-api in transactions: E.G
const createdProducts = await db.transaction(async (tx): Promise<RandomType> => {
await Promise.all(
_.chunk(
productOptions.map((productOption): typeof products.$inferInsert => ({
...productOption,
productSetId,
userId: req.user.userId
})),
500
).map(async (productsChunk) => tx.insert(products).values(productsChunk))
);
})
const createdProducts = await db.transaction(async (tx): Promise<RandomType> => {
await Promise.all(
_.chunk(
productOptions.map((productOption): typeof products.$inferInsert => ({
...productOption,
productSetId,
userId: req.user.userId
})),
500
).map(async (productsChunk) => tx.insert(products).values(productsChunk))
);
})
However, it returns this error: DatabaseErrorException: Transaction is still running a query Its like this for all Promise.all inside the transaction What I've tried: Applying different patches to drizzle-orm (from people's prs fixing data-api transaction issues) - Didn't work Made the request synchronous - Worked Making it concurrent without promise.all(didn't work) Reducing (by >100x) the amount of requests that were made (didn't work for bigger payloads. It appears to work with regular updating with the maxed out options, however it doesn't work with sth like create where I can't optimise away the amount of queries) By reduced, I mean I reduced from about 15,020 queries to 2 queries in one of the promise.all and 30,000 to 2 also.(in my scenario) Messing around with delays etc(also didn't work)
1 Reply
hanbao
hanbao4mo ago
@Vision2023 habe you resolved this? I'm experiencing the same issue
Want results from more Discord servers?
Add your server