© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
15 replies
tomchristensen

Inconsistent transactions with Drizzle/Planetscale

I'm having issues with updating multiple records in parallel using
Promise.all
Promise.all
inside a transaction using Planetscale's serverless driver. I've created a minimal repro here: https://github.com/tomqchristensen/drizzle-ps-tx. The gist of it is that trying to update multiple records in parallel using something like this:

const updateParallelTx = async (n: number) =>
  db.transaction(async (tx) => {
    const promises = fooIds.map(async (id) =>
      tx.update(t.foo).set({ n }).where(eq(t.foo.id, id))
    );
    await Promise.all(promises);
  });
const updateParallelTx = async (n: number) =>
  db.transaction(async (tx) => {
    const promises = fooIds.map(async (id) =>
      tx.update(t.foo).set({ n }).where(eq(t.foo.id, id))
    );
    await Promise.all(promises);
  });


results in only a single record being updated and no errors thrown, i.e. the exact opposite to what one would expect from a transaction. Any ideas as to why this is the case?

Happy to open an issue on GH if this is indeed a bug.
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Drizzle Kit + Planetscale example?
Drizzle TeamDTDrizzle Team / help
3y ago
Merge Knex and Drizzle Transactions
Drizzle TeamDTDrizzle Team / help
2mo ago
Best practices for handling planetscale DatabaseErrors with Drizzle?
Drizzle TeamDTDrizzle Team / help
3y ago
Next.js, Drizzle and Supabase DB with transactions?
Drizzle TeamDTDrizzle Team / help
15mo ago