cancel
Showing results for 
Search instead for 
Did you mean: 

timeout error when posting a request to CAP Application deployed to SCP

Hi, experts.

I have an error when posting odata 'create' request to CAP Node.js Application. the CAP app has been deployed to the SAP Cloud Platform

'TimeoutError: ResourceRequest timed out'.

Any ideas ?

brunonalon
Explorer
0 Kudos

I am facing the same problem today. 2 days ago was all working fine and I did not do any changes to my code.

I notice that the lib @sap/cds-runtime did some update on the pool client on the last version.

********@sap/cds-runtime CHANGELOG.md************

## Version 2.7.7 - 2020-12-08
### Fixed
- In `hdb` driver, stored procedures without OUT parameters can now return values - Service consumption when using `.get('/')`
## Version 2.7.6 - 2020-12-07
### Fixed
- Validate pool clients before use - Improved default pool configuration - Remove `req.run` deprecation warning

wolf0411
Member
0 Kudos

Hello , i have the same error but with RabbitMQ ,

Error: Failed to connect to: amqp://bla-production:***@localhost:5672/bla-bla-production?heartbeat=10&connection_timeout=10000&channelMax=100.

Original message was: connect ETIMEDOUT

ERR at Socket.<anonymous> (/path/in/server/app/node_modules/amqplib/lib/connect.js:172:20)

ERR at Object.onceWrapper (events.js:286:20)

ERR at Socket.emit (events.js:198:13)

ERR at Socket._onTimeout (net.js:443:8)

ERR at ontimeout (timers.js:436:11)

ERR at tryOnTimeout (timers.js:300:5)

ERR at listOnTimeout (timers.js:263:5)

ERR at Timer.processTimers (timers.js:223:10).

Help would be appreciated a lot.

View Entire Topic

Solved by two options;

① Close transaction manually.

1. committing the transaction manually -> call tx.commit() or tx.rollback()

2. using srv.run(query) -> wraps the queries into a separate transaction which is automatically committed or rolled back

3. binding the transaction to the incoming request, which automatically commits or rolls back depending on the success of a request -> srv.tx(req)

②Configuration of pool (generic-pool)

in package.json

add parameter 'pool' to 'requires'->'db' configuration.

{
  "cds": {
    "requires": {
      "db": {
        "kind": "hana",
        "pool": {
          "max": 1400,
          "min": 100
        }
      }
    }
  }
}
ed_chavez_pe84
Discoverer
0 Kudos

Hi @haihua.zhang,

i tried config my package.json but i see the same error

any suggest?

Regards

0 Kudos

Hi , @ed_chavez_pe84

Please check the configuration of 'pool' property. it is belong to 'db' property.

aelghannam
Participant
0 Kudos

Hello Haihua,

I am able to do my "Select"s queries using transactions (as it says how to do that in the CAP documentation). Any idea how this is done for "Insert"s or "Update"s ?