10

SAP CAP: Error during request to remote service, t... - SAP Community

 2 months ago
source link: https://community.sap.com/t5/technology-q-a/sap-cap-error-during-request-to-remote-service-timeout-of-10000ms-exceeded/qaq-p/13617452
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

SAP CAP: Error during request to remote service, timeout of 10000ms exceeded

MMonis

Explorer

an hour ago

- last edited

an hour ago

We have a SAP CAP service, which connects to SAP SuccessFactors to post/upsert data to SF.

The error is "statusCode":502,"reason":{"message":"Error during request to remote service: \ntimeout of 10000ms exceeded","name":"AxiosError","config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"proxy":false,"method":"post"

The error occurs in situations where we post a larger chunk of data to SAP SF, and the response from SAP SF takes more than 10000ms. It seems the SAP CAP service doesn't wait beyond 10000ms for a response back from SAP SF, and then just throws the above error. It works fine if SAP SF comes back with a response within this time. If we try through postman, this works fine with a large chunk of data.

We are using a SAP BTP destination for connectivity to SAP SF and have maintained the config in the packgage.json as 

...
"cds": {
        "requires": {
            "sf_tech": {
                "kind": "odata",
                "model": "srv/external/sf-tech",
                "credentials": {
                    "destination": "SFTech",
                    "requestTimeout": 80000 // also tried 30000
                }
            }
        }
}
...

The SAP CAP service code that triggers the post/upsert to SAP SF is 

import { Request, Service } from "@sap/cds";
...
const headers = {
      MaxDataServiceVersion: this.dataServiceVersion,
      "Content-Type": `multipart/mixed; boundary=${batchId}`,
    };
let response = await (this.service as Service)
        .transaction(this.request)
        .send("POST", "/$batch", this.batchBody as String, headers);
...

The app is deployed to sap cloud foundry and the btp destination from above is also configured and maintained.

Does anyone know where to increase/set the timeout beyond 10000ms ?

Regards,


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK