2024 Aug 01 3:20 PM
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:
Is the configuration correct, or are there further steps I need to take?
Thank you!
Christopher
2024 Aug 02 9:38 AM
The connection property host should be just the host name(<host>) without the prefix jdbc:postgresql://
2024 Aug 02 1:46 PM
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"
}
}
}
}
}