Skip to content
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

postgres in hybrid profile #476

Open
lucasborin opened this issue Feb 23, 2024 · 5 comments
Open

postgres in hybrid profile #476

lucasborin opened this issue Feb 23, 2024 · 5 comments
Labels
author action bug Something isn't working postgres

Comments

@lucasborin
Copy link

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
@lucasborin lucasborin added the bug Something isn't working label Feb 23, 2024
@vobu
Copy link
Collaborator

vobu commented Feb 27, 2024

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?

@patricebender
Copy link
Member

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

@lucasborin
Copy link
Author

@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.

@arunkrishnamoorthy
Copy link

[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

@BobdenOs
Copy link
Contributor

@arunkrishnamoorthy it is not possible to give support with the ResourceRequest timed out error. If you are still facing this issue please catch the error thrown here. Most likely the error message will already give you an indication of what is going wrong. Most likely the connection is being rejected as your host is blocked. It is standard practice for internal services to only allow known internal host to connect to the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author action bug Something isn't working postgres
Projects
None yet
Development

No branches or pull requests

5 participants