error: database "default" does not exist

After install I made 'default' database manually and run the main 2 comands yarn and my twenty env was running nice! But after my swarm restart I do not know why the default database is missing with this erro below.
[Nest] 34 - 02/24/2025, 2:58:46 PM ERROR [ExceptionHandler] database "default" does not exist

error: database "default" does not exist

at Parser.parseErrorMessage (/app/node_modules/pg/node_modules/pg-protocol/dist/parser.js:283:98)

at Parser.handlePacket (/app/node_modules/pg/node_modules/pg-protocol/dist/parser.js:122:29)

at Parser.parse (/app/node_modules/pg/node_modules/pg-protocol/dist/parser.js:35:38)

at Socket.<anonymous> (/app/node_modules/pg/node_modules/pg-protocol/dist/index.js:11:42)

at Socket.emit (node:events:514:28)

at addChunk (node:internal/streams/readable:324:12)

at readableAddChunk (node:internal/streams/readable:297:9)

at Readable.push (node:internal/streams/readable:234:10)

at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
[Nest] 34 - 02/24/2025, 2:58:46 PM ERROR [ExceptionHandler] database "default" does not exist

error: database "default" does not exist

at Parser.parseErrorMessage (/app/node_modules/pg/node_modules/pg-protocol/dist/parser.js:283:98)

at Parser.handlePacket (/app/node_modules/pg/node_modules/pg-protocol/dist/parser.js:122:29)

at Parser.parse (/app/node_modules/pg/node_modules/pg-protocol/dist/parser.js:35:38)

at Socket.<anonymous> (/app/node_modules/pg/node_modules/pg-protocol/dist/index.js:11:42)

at Socket.emit (node:events:514:28)

at addChunk (node:internal/streams/readable:324:12)

at readableAddChunk (node:internal/streams/readable:297:9)

at Readable.push (node:internal/streams/readable:234:10)

at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
3 Replies
thomast
thomast7d ago
hard to debug, looks like a config issue. Do you manage to connect to your db manually?
lucas lima
lucas limaOP5d ago
I deploy with swarm. On compose do you have any commands to creat default database?
thomast
thomast4d ago
Compose is supposed to init your database the first time and then you are good. I don't use swarm but it may not work the same way. Since you are saying that compose works fine but this is your swarm restart that breaks DB setup, I am just guessing that this is a database init missing for swarm

Did you find this page helpful?