cds-dbm
cds-dbm copied to clipboard
deploy create DB log shows error while succeeding
Hi,
When deploying creating a new DB - using npx cds-dbm deploy --create-db - I am getting the following error thrown (logs adjusted and db name replaced with XXXX).
npx cds-dbm deploy --create-db [cds-dbm] - starting delta database deployment of service db (node:10333) UnhandledPromiseRejectionWarning: error: database "XXXX" does not exist at Parser.parseErrorMessage (/node_modules/pg-protocol/dist/parser.js:287:98) at Parser.handlePacket (/node_modules/pg-protocol/dist/parser.js:126:29) at Parser.parse (/node_modules/pg-protocol/dist/parser.js:39:38) at Socket.<anonymous> (/node_modules/pg-protocol/dist/index.js:11:42) at Socket.emit (events.js:400:28) at addChunk (internal/streams/readable.js:293:12) at readableAddChunk (internal/streams/readable.js:267:9) at Socket.Readable.push (internal/streams/readable.js:206:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) (Use
node --trace-warnings ...to show where the warning was created) (node:10333) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:10333) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. [cds-dbm] - created database XXX
But the database is created anyways ... so it is a bit confusing. The command seems to work but somehow fails to handle a promise rejection ?
The DB logs shows
UTC [162] FATAL: database "XXXX" does not exist
Which is prob causing this ...
Kind Regards
Steven
Hi Steven,
in which environment do you get this error?
Hi @gregorwolf ,
Running locally with a docker composed DB instance
image: postgres:alpine
CDS version.
@sap/cds: 5.9.1 @sap/cds-compiler: 2.13.8 @sap/cds-dk: 3.3.5
Kind Regards,
Steven
Hi @sedacrivity,
I've just tried that with pg-beershop. Before I've tried I deleted all old containers and removed also the images. Then I ran:
npm run docker:start:pg
npm run deploy:pg
The output of the last command was:
> [email protected] deploy:pg /Users/gwolf/Documents/Projects/cap/pg-beershop
> npx cds-dbm deploy --create-db
[cds-dbm] - starting delta database deployment of service db
[cds-dbm] - created database beershop
[cds-dbm] - delta successfully deployed to the database
running:
npm run deploy:pg:load
gave me:
> [email protected] deploy:pg:load /Users/gwolf/Documents/Projects/cap/pg-beershop
> npx cds-dbm deploy --create-db --load-via delta
[cds-dbm] - starting delta database deployment of service db
[cds-dbm] - database beershop is already present
[cds-dbm] - delta successfully deployed to the database
[cds-dbm] - loading data from /Users/gwolf/Documents/Projects/cap/pg-beershop/db/data/csw-Beers.csv
[cds-dbm] - loading data from /Users/gwolf/Documents/Projects/cap/pg-beershop/db/data/csw-Brewery.csv
[cds-dbm] - loading data from /Users/gwolf/Documents/Projects/cap/pg-beershop/db/data/csw-TypeChecks.csv
and then I started the app with
npm run start
and I see results from the service.
I have the same problem. the example repository really works. but this way we are only going to create pg-beershop projects.