-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BatchResponse Handling: Changeset always successfull but isn't #5106
Comments
Hey @drvup, this has not changed in a long time and it is intended. When sending requests as batches you can send multiple changesets or retrieve requests together. When one of them fails, the total response will still be successful, but the individual responses underneath might indicate errors, much like I recommend to take a look at the docs for details on response handling with batch. Please also note that changesets should be atomic, but every service owner could implement this differently... |
Hi @marikaner thanks for coming back to me about it. We debugged this deeper and identified the original reason for it. CAP v8 has adjusted the batch-response approach in comparison to the CAP v7 version. It's now part of the changeset-response, instead of the direct batch-response:
(this was the same request, send to 2 different CAP Apps) I am with you about the handling of But, if an atomic changset ist failing, because one changeset-request-response is failed, the SDK should set the deserializeChangeSet(changesetData) {
const requestOfChangesetFailed = changesetData.some(subResponseData => !batch_response_parser_1.isHttpSuccessCode(subResponseData.httpCode));
return {
responses: changesetData.map(subResponseData => this.deserializeChangeSetSubResponse(subResponseData)),
isSuccess: () => !requestOfChangesetFailed,
isError: () => requestOfChangesetFailed,
isReadResponse: () => false,
isWriteResponses: () => true
};
} However, the SDK could also provide a capability to enhance it on the consumer site? Let me know what you think & thanks for taking the time, it's really appreciated :) BR, |
Describe the bug
We do send multiple requests in a batch to a SAP CAP application. Within, we do upsert different entities on the CAP app.
It's working fine, but since some weeks, we discovered missing requests sent to our CAP app.
We checked our logs and were wondering why there is nothing discovered.
Today, we did debug this locally and identified, if a request inside a changeset as part of the batch send to CAP is rejected (e.g. the payload had a property who is not valid / existing), the SAP Cloud SDK is setting the changeset to
isSuccess
, instead ofisError
.To Reproduce
Steps to reproduce the behavior:
Example:
Expected behavior
The changeset is not successful, as the response from CAP is showing http status 400 for the request within the changeset.
A changeset is always atomic. So, if one request inside a changeset is failing, the complete changeset is failing.
We also do send a custom header: "prefer": "odata.continue-on-error"
Having this customizing, the complete batch request is NOT failing, but the request due to the not-existing-property-thing, is failing. You can see the response for the request on the CAP app on the screenshot.
Screenshots

Used Versions:
Additional Information
While debugging, I saw on file
odata-common/request-builder/batch/batch-response-deserializer.js
, as soon as it's a changeset, the deserialize methoddeserializeChangeSet()
does set theisSuccess
totrue
. From my POV, this should not be the case and there should be a check on the sub method, if the response is failed.I do wonder if this was never there and just discovered ( after 4 years running on production ) or if there was a code change in place.
Impact / Priority
Affected development phase: Production
Impact: Inconvenience / Impaired
Best regards,
Cedric
The text was updated successfully, but these errors were encountered: