drizzle-team/drizzle-orm · error · Error

Transactions are not supported by the SingleStore Proxy driv

Error message

Transactions are not supported by the SingleStore Proxy driver

What it means

Thrown by SingleStoreRemoteSession.transaction (singlestore-proxy/session.ts:76). The proxy/remote driver is a stateless request/response transport over a remote callback and cannot open a durable transaction session, so any attempt to start a transaction is rejected explicitly rather than silently no-op'ing.

Source

Thrown at drizzle-orm/src/singlestore-proxy/session.ts:76

			this.logger,
			fields,
			customResultMapper,
			generatedIds,
			returningIds,
		) as PreparedQueryKind<SingleStoreRemotePreparedQueryHKT, T>;
	}

	override all<T = unknown>(query: SQL): Promise<T[]> {
		const querySql = this.dialect.sqlToQuery(query);
		this.logger.logQuery(querySql.sql, querySql.params);
		return this.client(querySql.sql, querySql.params, 'all').then(({ rows }) => rows) as Promise<T[]>;
	}

	override async transaction<T>(
		_transaction: (tx: SingleStoreProxyTransaction<TFullSchema, TSchema>) => Promise<T>,
		_config?: SingleStoreTransactionConfig,
	): Promise<T> {
		throw new Error('Transactions are not supported by the SingleStore Proxy driver');
	}
}

export class SingleStoreProxyTransaction<
	TFullSchema extends Record<string, unknown>,
	TSchema extends TablesRelationalConfig,
> extends SingleStoreTransaction<
	SingleStoreRemoteQueryResultHKT,
	SingleStoreRemotePreparedQueryHKT,
	TFullSchema,
	TSchema
> {
	static override readonly [entityKind]: string = 'SingleStoreProxyTransaction';

	override async transaction<T>(
		_transaction: (tx: SingleStoreProxyTransaction<TFullSchema, TSchema>) => Promise<T>,
	): Promise<T> {
		throw new Error('Transactions are not supported by the SingleStore Proxy driver');

View on GitHub (pinned to b7862528fd)

Solutions

  1. Switch to a driver that supports transactions (e.g. the node mysql2-based SingleStore driver) when you need transactions.
  2. If you must use the proxy driver, restructure logic to avoid transactions (single-statement atomic writes, or application-level compensation).
  3. Detect the driver at runtime and skip or replace transactional code paths.

Example fix

// before (proxy driver)
await db.transaction(async (tx) => {
  await tx.insert(a).values(x);
  await tx.insert(b).values(y);
});
// after (use a transaction-capable driver)
import { drizzle } from 'drizzle-orm/singlestore';
const db = drizzle(pool);
await db.transaction(async (tx) => { /* ... */ });
Defensive patterns

Strategy: type-guard

Validate before calling

import { is } from 'drizzle-orm/entity';
function supportsTransactions(db) {
  return !(db.session instanceof Object && db.session?.constructor?.name === 'SingleStoreRemoteSession');
}
if (!supportsTransactions(db)) throw new Error('Use a transaction-capable driver');

Type guard

function isProxySession(db) {
  return /SingleStoreRemoteSession|SingleStoreProxy/.test(db?.session?.constructor?.name ?? '');
}

Try / catch

try { await db.transaction(async (tx) => { /* ... */ }); }
catch (e) { if (/Transactions are not supported by the SingleStore Proxy driver/.test(e.message)) { /* switch driver */ } throw e; }

Prevention

When it happens

Trigger: Calling db.transaction(...) on a database created via drizzle-orm/singlestore-proxy (SingleStoreRemoteSession / RemoteCallback driver); using a shared code path that assumes transactions are available across drivers.

Common situations: Targeting SingleStore via the HTTP/proxy driver in serverless/edge environments; abstracting db access behind an interface that calls transaction() but the proxy deployment doesn't support it.

Related errors


AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03). Data as JSON: /data/errors/b90ba5e5256f6936.json. Report an issue: GitHub.