{"record":{"id":"73d67155859dc7b2","repo":"tursodatabase/turso","slug":"transactionasync-is-not-supported-with-remotewrite-73d671","errorCode":null,"errorMessage":"transactionAsync is not supported with remoteWritesExperimental yet; use the deprecated transaction() for now","messagePattern":"transactionAsync is not supported with remoteWritesExperimental yet; use the deprecated transaction\\(\\) for now","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bindings/javascript/sync/packages/wasm/promise-turbopack-hack.ts","lineNumber":333,"sourceCode":"        Object.defineProperties(properties.immediate.value, properties);\n        Object.defineProperties(properties.exclusive.value, properties);\n        return properties.default.value as TransactionFunction<F>;\n    }\n\n    /**\n     * Returns a function that executes the given function in a transaction\n     * on a connection owned for the whole BEGIN..COMMIT window; the callback\n     * receives a {@link Transaction} handle as its first argument.\n     *\n     * Not supported together with {@link DatabaseOpts.remoteWritesExperimental}\n     * yet: remote-writes transactions run on the remote server and have no\n     * local connection to hand out.\n     */\n    override transactionAsync<F extends (txn: Transaction, ...args: any[]) => Promise<any>>(\n        fn: F,\n    ): AsyncTransactionFunction<F> {\n        if (this.#remoteWriter) {\n            throw new Error(\n                \"transactionAsync is not supported with remoteWritesExperimental yet; use the deprecated transaction() for now\",\n            );\n        }\n        return super.transactionAsync(fn);\n    }\n\n    /**\n     * close the database and relevant files\n     */\n    async close() {\n        if (this.#remoteWriter) {\n            await this.#remoteWriter.close();\n        }\n        if (this.#engine != null) {\n            if (this.name != null && this.#worker != null) {\n                await Promise.all([\n                    unregisterFileAtWorker(this.#worker, this.name),\n                    unregisterFileAtWorker(this.#worker, `${this.name}-wal`),","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/tursodatabase/turso/blob/bad083fafbefdeae9a42ec19bdaaad8918dcf411/bindings/javascript/sync/packages/wasm/promise-turbopack-hack.ts#L315-L351","documentation":"The WASM promise wrapper's transactionAsync() override throws when the database was opened with DatabaseOpts.remoteWritesExperimental. Remote-writes transactions run entirely on the remote server, so there is no local connection to hand to the callback as a Transaction handle. The library rejects the call up front instead of silently running the transaction in the wrong place. The doc comment on the override states this limitation explicitly.","triggerScenarios":"Constructing the database with `new Database(path, { url, authToken, remoteWritesExperimental: true })` and then calling `db.transactionAsync(async (txn) => { ... })`. The throw happens synchronously inside transactionAsync() as soon as the #remoteWriter is present, before any transaction work starts.","commonSituations":"Enabling remoteWritesExperimental on an existing app that already used transactionAsync; upgrading @tursodatabase/sync-wasm to a version where remoteWritesExperimental was introduced; copying transactionAsync examples from the local-sync docs into a remote-writes deployment; sharing transaction helper code between local and remote-writes databases.","solutions":["Switch the call to the deprecated db.transaction(fn) — its override detects the remote writer and routes the whole BEGIN..COMMIT to the remote server via remoteWriter.beginTransaction/commit","Branch on the config you constructed the database with: use transaction(fn) when remoteWritesExperimental is set, transactionAsync(fn) otherwise","If the Transaction-handle API is a hard requirement, drop remoteWritesExperimental and use local writes plus push() to synchronize"],"exampleFix":"// before\nconst db = new Database(\"app.db\", { url, authToken, remoteWritesExperimental: true });\nconst tx = db.transactionAsync(async (txn) => { await txn.execute(\"INSERT ...\"); }); // throws\n\n// after\nconst db = new Database(\"app.db\", { url, authToken, remoteWritesExperimental: true });\nconst tx = db.transaction(async () => { await db.execute(\"INSERT ...\"); }); // runs BEGIN..COMMIT on the remote","handlingStrategy":"validation","validationCode":"// Decide up front, from the opts you control, which transaction API is legal\nconst opts: DatabaseOpts = { url, authToken, remoteWritesExperimental: true };\nconst db = new Database(path, opts);\n\nfunction makeTxn<T extends (...args: any[]) => Promise<any>>(db: Database, fn: T) {\n  return opts.remoteWritesExperimental\n    ? db.transaction(fn)        // remote-aware override\n    : db.transactionAsync(fn); // local connection handle OK\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Branch on your own DatabaseOpts — the wrapper's #remoteWriter is private and not queryable","Wrap transaction creation in one helper so the remote/local split lives in a single place","Watch release notes: transactionAsync support for remote writes is on the roadmap, so revisit once supported"],"tags":["transaction","remote-writes","wasm","turbopack","sync"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"bad083fafbefdeae9a42ec19bdaaad8918dcf411","analyzedAt":"2026-08-16T23:12:11.798Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}