No transactions support in neon-http driver even though neon provides a transaction function

https://neon.tech/docs/serverless/serverless-driver#when-to-use-the-neon-function-vs-pool-or-client

I tried to execute a db operation such as below. I am getting throw new Error('No transactions support in neon-http driver');

I'm not sure if the kind of code below is an "interactive" or "non-interactive" transaction, but wondering if maybe I am missing something. Does drizzle support the neon(...) transaction() function?



await db.transaction(async tx => {
        // Insert New Contact
        const insertedContact = await tx
            .insert(contacts)
            .values(newContact)
            .returning()
        if (newEmails) {
            // Take in array of email objects
            for (const email of newEmails) {
                // Insert or update New Email
                const insertedEmail = await tx
                    .insert(emails)
                    .values(email)
                    .onConflictDoUpdate({ target: emails.emailId, set: email })
                    .returning({ id: emails.emailId })
                // For each email, add relationship to join table
                await tx.insert(emailsToContacts).values({
                    contactId: insertedContact[0].contactId,
                    emailId: insertedEmail[0].id,
                })
            }
        }
Neon
The Neon serverless driver is a low-latency Postgres driver for JavaScript and TypeScript that allows you to query data from serverless and edge environments over HTTP or WebSockets in place of TCP. Y...
Was this page helpful?