-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Use-Case. In an insert query, the following must hold true:
req.query.INSERT.entries[0] === req.data
Event queue serializes req, and stores as payload. During deserialization data and query get disconnected, so that the following assumption does not hold true.
This leads to failures later as for example @readonly keys (ID) are not filled, leading to not null exceptions on DB.
SOLUTION:
Code @cap-js-community/event-queue/src/outbox/EventQueueGenericOutboxHandler.js must build up the relationship again from parsed JSON. So that for req.data is bound again to the query.
This happens automatically, when data is not part of the payload during building of cds.Request.
So it needs to be checked what type of query it is, and if it holds the data already in the query, so that req.data is redundant and can be skipped?
Pseudocode for INSERT
if (payload.query?.INSERT) {
delete payload.data; // data is build up from `req.query.INSERT.entries[0]`
}Similar may be necessary for other queries.... UPDATE, UPSERT, etc...