#Transaction error

5 messages · Page 1 of 1 (latest)

random plinth
#

I can help!
This error usually happens when the transaction isn’t being created in the same database scope as the operations, or when the SDK call returns a transaction object that’s actually null/not committed.

Quick question:
When you call createTransaction(), are you sure it's using the same database ID (68ff00b800318a2a0fa8) you're passing in the operations? Some SDKs require specifying the database when creating the transaction.

If you can share how createTransaction() is implemented in your TablesDB class, I can point out the exact issue.

somber belfry
# random plinth I can help! This error usually happens when the transaction isn’t being created ...

thanks a lot in advance
am sharing my code snip bellow
as you said I have created every thing is inside the function createOperations{}
but sadly getting the error
Uncaught error: AppwriteException: transaction_not_found, Transaction with the requested ID could not be found. (404)
The curd operation without transaction is happening

Future createOperations() async {
final client = Client()
.setEndpoint(AppwriteConstants.apiEndPoint)
.setProject(AppwriteConstants.projectId);

final tablesDB = TablesDB(client);

final tx = await tablesDB.createTransaction();
print(tx);
await tablesDB.createOperations(
  transactionId: tx.$id,
  operations: [
    {
      'action': 'create',
      'databaseId': 'test_db',
      'tableId': 'table_1',
      'rowId': ID.unique(),
      'data': {'name': 'Walter'},
    },
    {
      'action': 'create',
      'databaseId': 'test_db',
      'tableId': 'table_2',
      'rowId': ID.unique(),
      'data': {'name': 'new Walter'},
    },
  ],
);

await tablesDB.updateTransaction(transactionId: tx.$id, commit: true);

}

random plinth
#

Quick question:
In your TablesDB class, does createTransaction() accept or use the databaseId? If not, that’s almost definitely the root cause.

If you want, send me a message with the TablesDB class code I can pinpoint the exact fix in a few minutes.

somber belfry