question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to fetch instance destinations. (Timed out after 10000ms)

See original GitHub issue

Description of erroneous behaviour

We have a Node.js CAP application edom-retailer-core. In MDIClient.js, we are making a request via destination connecting to MdiDestination.

// package.json
"MdiDestination": {
   "kind": "rest",
   "credentials": {
      "destination": "mdi-dest",
      "requestTimeout": 1000000

The API in the destination retrieves 2000 items at a time and if it has more data, it will provide a deltaToken that we use to make the same call but with the deltaToken to retrieve the next 2000 items. We repeat this till all the items are retrieved. Currently our API has 19000+ items.

// MDIClient.js
const MDIDest = await cds.connect.to('MdiDestination');
const logRequest = new cds.Request();
const baseQuery = `GET /log/sap.odm.businesspartner.BusinessPartner`;

let moreData = true;
while (moreData) {
   if (deltaToken !== false) {
     logRequest.query = `${baseQuery}?since=${deltaToken}`;
   }
   const response = await MDIDest.tx(logRequest).run(logRequest.query);

   ...

   if (!response.hasMoreEvents) {
      moreData = false;
   }
}

The request is successful for the first 6-9 iterations but throws an error afterwards:

Error: Timed out after 10000ms
    at buildError (/mnt/c/Users/C5315270/Desktop/projects/edom-retailer-core/node_modules/opossum/lib/circuit.js:710:17)
    at Timeout.<anonymous> (/mnt/c/Users/C5315270/Desktop/projects/edom-retailer-core/node_modules/opossum/lib/circuit.js:511:29)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7) {
  cause: ErrorWithCause: Failed to fetch instance destinations.
      at new ErrorWithCause (/mnt/c/Users/C5315270/Desktop/projects/edom-retailer-core/node_modules/@sap-cloud-sdk/util/dist/error-with-cause.js:31:16)
      at /mnt/c/Users/C5315270/Desktop/projects/edom-retailer-core/node_modules/@sap-cloud-sdk/core/dist/connectivity/scp-cf/destination/destination-service.js:116:27
      at runNextTicks (internal/process/task_queues.js:62:5)
      at listOnTimeout (internal/timers.js:523:9)
      at processTimers (internal/timers.js:497:7)
      at async Promise.all (index 0)

I attached the console log and console error below. log.txt error.txt

Detailed steps to reproduce

For example (→ replace by appropriate ones for your case):

  1. git clone https://github.wdf.sap.corp/c4u/edom-retailer-core.git
  2. git checkout feat/25-mdiclient-outbound
  3. npm install
  4. cds deploy
  5. cds run
  6. In Postman, make a GET request to http://localhost:4004/api/alpha/mdiclient/MDIClient

Details about your project

edom-retailer https://github.wdf.sap.corp/c4u/c4u-cn-edom-retailer
CAP Java Runtime version
OData Version version
@sap/cds-compiler 2.1.6
@sap/cds-dk 4.0.7

Used Versions:

  • node version via node -v: v12.22.1
  • npm version via npm -v: 6.14.12
  • SAP Cloud SDK version you used as dependency

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:25 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
LaxOncommented, Jun 23, 2021

I’m able to connect to the consumer subaccount by providing a userJwt. Thank you! await cloudSDK.getDestination('mdi-dest',{ useCache: true, isolationStrategy: "Tenant", userJwt:jwt})

1reaction
marikanercommented, May 6, 2021

Hey @LaxOn,

btw, you can enable the SDK caching if you transform this line: const dest = await cloudSDK.getDestination('mdi-dest'); to this: const dest = await cloudSDK.getDestination('mdi-dest', { useCache: true });

Read more comments on GitHub >

github_iconTop Results From Across the Web

MongooseError: Operation `users.insertOne()` buffering timed ...
I'm running MongoDB Atlas on node express and I got this error when I tested with postman.
Read more >
How to fix cURL error 28: Connection timed out after X ...
In this article, we will show you how to easily fix the 'cURL error 28: Connection timed out' issue on your WordPress website....
Read more >
Use SSM Agent logs to troubleshoot issues with SSM ... - AWS
AWS Systems Manager Agent (SSM Agent) fails to run successfully, but I don't know how to troubleshoot ... INFO- Failed to fetch instance...
Read more >
MongooseError: Operation `users.insertOne()` buffering timed ...
I built some MERN app where I didn't face this type of error. But recently I am making a ... insertOne()` buffering timed...
Read more >
SSL Handshake Timeout errors when associating a VMware ...
Cannot Associate a VMware Cloud Director service Instance with an SDDC ... SslHandshakeTimeoutException: handshake timed out after 10000ms.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found