{"id":"b90ba5e5256f6936","repo":"drizzle-team/drizzle-orm","slug":"transactions-are-not-supported-by-the-singlestore","errorCode":null,"errorMessage":"Transactions are not supported by the SingleStore Proxy driver","messagePattern":"Transactions are not supported by the SingleStore Proxy driver","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-orm/src/singlestore-proxy/session.ts","lineNumber":76,"sourceCode":"\t\t\tthis.logger,\n\t\t\tfields,\n\t\t\tcustomResultMapper,\n\t\t\tgeneratedIds,\n\t\t\treturningIds,\n\t\t) as PreparedQueryKind<SingleStoreRemotePreparedQueryHKT, T>;\n\t}\n\n\toverride all<T = unknown>(query: SQL): Promise<T[]> {\n\t\tconst querySql = this.dialect.sqlToQuery(query);\n\t\tthis.logger.logQuery(querySql.sql, querySql.params);\n\t\treturn this.client(querySql.sql, querySql.params, 'all').then(({ rows }) => rows) as Promise<T[]>;\n\t}\n\n\toverride async transaction<T>(\n\t\t_transaction: (tx: SingleStoreProxyTransaction<TFullSchema, TSchema>) => Promise<T>,\n\t\t_config?: SingleStoreTransactionConfig,\n\t): Promise<T> {\n\t\tthrow new Error('Transactions are not supported by the SingleStore Proxy driver');\n\t}\n}\n\nexport class SingleStoreProxyTransaction<\n\tTFullSchema extends Record<string, unknown>,\n\tTSchema extends TablesRelationalConfig,\n> extends SingleStoreTransaction<\n\tSingleStoreRemoteQueryResultHKT,\n\tSingleStoreRemotePreparedQueryHKT,\n\tTFullSchema,\n\tTSchema\n> {\n\tstatic override readonly [entityKind]: string = 'SingleStoreProxyTransaction';\n\n\toverride async transaction<T>(\n\t\t_transaction: (tx: SingleStoreProxyTransaction<TFullSchema, TSchema>) => Promise<T>,\n\t): Promise<T> {\n\t\tthrow new Error('Transactions are not supported by the SingleStore Proxy driver');","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-orm/src/singlestore-proxy/session.ts#L58-L94","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Switch to a driver that supports transactions (e.g. the node mysql2-based SingleStore driver) when you need transactions.","If you must use the proxy driver, restructure logic to avoid transactions (single-statement atomic writes, or application-level compensation).","Detect the driver at runtime and skip or replace transactional code paths."],"exampleFix":"// before (proxy driver)\nawait db.transaction(async (tx) => {\n  await tx.insert(a).values(x);\n  await tx.insert(b).values(y);\n});\n// after (use a transaction-capable driver)\nimport { drizzle } from 'drizzle-orm/singlestore';\nconst db = drizzle(pool);\nawait db.transaction(async (tx) => { /* ... */ });","handlingStrategy":"type-guard","validationCode":"import { is } from 'drizzle-orm/entity';\nfunction supportsTransactions(db) {\n  return !(db.session instanceof Object && db.session?.constructor?.name === 'SingleStoreRemoteSession');\n}\nif (!supportsTransactions(db)) throw new Error('Use a transaction-capable driver');","typeGuard":"function isProxySession(db) {\n  return /SingleStoreRemoteSession|SingleStoreProxy/.test(db?.session?.constructor?.name ?? '');\n}","tryCatchPattern":"try { await db.transaction(async (tx) => { /* ... */ }); }\ncatch (e) { if (/Transactions are not supported by the SingleStore Proxy driver/.test(e.message)) { /* switch driver */ } throw e; }","preventionTips":["Pick a transaction-capable driver when you need ACID units.","Detect the proxy driver at startup and disable transactional code paths.","Use single-statement atomic writes where transactions are unavailable."],"tags":["transaction","proxy","singlestore","unsupported","driver"],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}