Describe the bug
The blnk workers process fails to index every transaction into Typesense with a 400 error. The root cause is that the transactions collection schema is created with join references pointing to balances.balance_id, but Typesense requires join references to target the document's primary key field (id).
To Reproduce
- Start blnk with Typesense enabled (BLNK_TYPESENSE_DNS set)
- Create a ledger, balance, and process any transaction
- Observe worker logs
4. Error log:
level=error msg="Error indexing batch txn_XXXX: failed to index primary
transactions/txn_XXXX: failed to upsert document in Typesense:
status: 400 response: {\"message\":\"Referenced field `balance_id` not
found in the collection `balances`.\"}"
Expected behavior
Transactions are indexed into Typesense successfully.
Root cause
The transactions Typesense collection is created with:
{ "name": "source", "reference": "balances.balance_id" }
{ "name": "destination", "reference": "balances.balance_id" }
Typesense's JOIN feature requires the referenced field to be the primary key (id) of the target collection, not just any indexed field. Although balances documents contain a balance_id field (with the same value as id), Typesense rejects it as a join target.
Fix
Change the references to point to balances.id:
{ "name": "source", "reference": "balances.id" }
{ "name": "destination", "reference": "balances.id" }
This works because blnk already sets the Typesense document id equal to balance_id when indexing balances.
Verification
After manually recreating the transactions collection with reference: "balances.id", upserts succeed immediately and the worker stops producing errors.
Environment
- blnk version: 0.14.0 (jerryenebeli/blnk:latest)
- Typesense version: 29.1
- Deployment: Docker Compose
Describe the bug
The blnk workers process fails to index every transaction into Typesense with a 400 error. The root cause is that the transactions collection schema is created with join references pointing to balances.balance_id, but Typesense requires join references to target the document's primary key field (id).
To Reproduce
4. Error log:
Expected behavior
Transactions are indexed into Typesense successfully.
Root cause
The transactions Typesense collection is created with:
{ "name": "source", "reference": "balances.balance_id" } { "name": "destination", "reference": "balances.balance_id" }Typesense's JOIN feature requires the referenced field to be the primary key (id) of the target collection, not just any indexed field. Although balances documents contain a balance_id field (with the same value as id), Typesense rejects it as a join target.
Fix
Change the references to point to balances.id:
{ "name": "source", "reference": "balances.id" } { "name": "destination", "reference": "balances.id" }This works because blnk already sets the Typesense document id equal to balance_id when indexing balances.
Verification
After manually recreating the transactions collection with reference: "balances.id", upserts succeed immediately and the worker stops producing errors.
Environment