Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CAP - How to deploy on a remote PostgreSQL DB (AWS)?

Christopher_Ketzler
Discoverer
474
Hello Experts,

I would like to deploy a CAP App (node.js) to an AWS PostgreSQL instance. I created a simple CAP App containing the bookshop sample and added the @cap-js/postgres plugin. It works fine when I deploy it to the BTP "Postgres, Hyperscaler Option". Now, I want to go one step further and deploy it to my remote PostgreSQL hosted by AWS. Connecting to the PostgreSQL via pgAdmin is possible. I added the following configuration to the package.json:

 

 

 

 

"cds": {
    "requires": {
      "auth": {
        "kind": "basic",
        "users": {
          "admin": {
            "password": "admin"
          }
        }
      },
      "db": {
        "kind": "postgres",
        "credentials": {
          "host": "jdbc:postgresql://<db host>",
          "port": <port>,
          "user": "<user>",
          "password": "<password>",
          "database": "postgres"
        },
        "dialect": "postgres",
        "impl": "@cap-js/postgres"
      }
    }
  }

 

 

 

 

While deploying the app I am receiving this error:

image.png

Is the configuration correct, or are there further steps I need to take?

 

Thank you!

Christopher

2 REPLIES 2

Dinu
Contributor
0 Kudos
296

The connection property host should be just the host name(<host>) without the prefix jdbc:postgresql://

Vitaliy-R
Developer Advocate
Developer Advocate
283

Please, check the syntax at https://cap.cloud.sap/docs/guides/databases-postgres#in-your-private-cdsrc-json:

{
  "requires": {
    "db": {
      "[pg]": {
        "kind": "postgres",
        "credentials": {
          "host": "localhost", 
          "port": 5432,
          "user": "postgres",
          "password": "postgres",
          "database": "postgres"
        }
      }
    }
  }
}