Data Router ยท console.warn
a join aggregate must be a non-empty object ...
Printed by Data Router, prefixed [lattice], since 1.84.0.
Warnings reference › data-router:join-aggregate-invalid
- Identifier
data-router:join-aggregate-invalid- Raised by
- Data Router
- Since
- 1.84.0
What happened
A many: true join was given an aggregate that is not a usable object - empty, or not an object at all. There is nothing to write onto the parent row, so the whole join is dropped and the rows pass through unenriched rather than the router throwing.
The fix
Set aggregate to an object of named reducers: { field: { fn, field? } }, one entry per result you want on the parent row.
The smallest fix
join: { from: 'line', foreignKey: 'orderId', many: true, aggregate: { lines: { fn: 'count' }, lineTotal: { field: 'amount', fn: 'sum' } } }
Reference
Covered in full at the API reference.