cap-js/cds-dbs

postgres in hybrid profile

lucasborin opened this issue · 6 comments

Description of erroneous behaviour

The statement cds watch --profile hybrid binds the Postgres instance, but the CAP read fails due to resource timeout.

CAP database call:

const entries = await cds.db.run(`SELECT * FROM ... LIMIT 10`)

Console (sensitive data hidden):

[odata] - POST /odata/v4/...
[cds] - TimeoutError: ResourceRequest timed out
    at ResourceRequest._fireTimeout (/home/.../node_modules/generic-pool/lib/ResourceRequest.js:62:17)
    at Timeout.bound (/home/.../node_modules/generic-pool/lib/ResourceRequest.js:8:15)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)

Project .cdsrc.json:

{
    "requires": {
        "destinations": true,
        "db": {
            "kind": "postgres",
            "dialect": "postgres",
            "impl": "@cap-js/postgres"
        },
        "auth": {
            "kind": "xsuaa",
            "restrict_all_services": false
        }
}

Project .cdsrc-private.json (sensitive data hidden):

{
  "requires": {
    "[hybrid]": {
      "destinations": {
        "binding": {
          "type": "cf",
          "apiEndpoint": "...",
          "org": "...",
          "space": "...",
          "instance": "...",
          "key": "...",
          "resolved": false
        },
        "kind": "destinations",
        "vcap": {
          "name": "destinations"
        }
      },
      "db": {
        "binding": {
          "type": "cf",
          "apiEndpoint": "...",
          "org": "...",
          "space": "...",
          "instance": "...",
          "key": "...",
          "resolved": false
        },
        "kind": "postgres",
        "vcap": {
          "name": "db"
        }
      },
      "auth": {
        "binding": {
          "type": "cf",
          "apiEndpoint": "...",
          "org": "...",
          "space": "...",
          "instance": "...",
          "key": "...",
          "resolved": false
        },
        "kind": "xsuaa",
        "vcap": {
          "name": "auth"
        }
      }
    }
  }
}

Details about your project

Interal Ask i840577
Node.js v18.19.0
@sap/cds 7.3.1
@sap/cds-compiler 4.3.2
@sap/cds-dk 7.3.2
@sap/cds-dk (global) 7.6.1
@sap/eslint-plugin-cds 2.6.3
@sap/cds-mtxs 1.12.1
@cap-js/cds-types 0.2.0
vobu commented

hm, I did the same thing, but on Azure: https://github.com/Azure-Samples/app-service-javascript-sap-cap-quickstart/blob/293b5a4d78c3ccd2ca38440b0b01a19c2ae6f517/src/.cdsrc.json#L26
that worked ootb.
→ assumption: this might be an issue with CF/destination?

@lucasborin have you been able to solve this problem on your end?

@lucasborin have you been able to solve this problem on your end?

I'm using SAP HANA now, and I was not able to use the postgres in hybrid mode.

[odata] - > READ Activities { '$count': 'true', '$filter': '(IsActiveEntity eq false or SiblingEntity/IsActiveEntity eq null)', '$select': 'HasActiveEntity,IsActiveEntity,accountManagerId,accountManagerName,activityAdministrator,activityDesc,activityId,activityOrg,contract,goLiveDate,modifiedAt,modifiedBy,projectManagerId,projectManagerName', '$skip': '0', '$top': '30' } [cds] - TimeoutError: ResourceRequest timed out at ResourceRequest._fireTimeout (/home/user/projects/timesheet/packages/server/node_modules/generic-pool/lib/ResourceRequest.js:62:17) at Timeout.bound (/home/user/projects/timesheet/packages/server/node_modules/generic-pool/lib/ResourceRequest.js:8:15) at listOnTimeout (node:internal/timers:573:17) at process.processTimers (node:internal/timers:514:7) Active connections:0 { id: '1017596', level: 'ERROR', timestamp: 1720285318950 }

I am facing the same issue. Is there a solution or workaround available for this to test the postgre db in hybrid mode