Error while running command npx nx database:reset twenty-server in WSL
Steps followed
1. Postgres on docker using the make command
2.Make env files
3.nvm to set node version to v18.17.1
4.yarn
5.npx nx database:reset
18 Replies
Hi @Vinay, your database does not seem to be properly initiated, could you share your .env?
Hi @charles Thanks so much for the reply here are the .env files for twenty-server and twenty-front
and your docker-compose.yaml?
your are doing docker+WSL which is a bit challenging in term of resources :p
You are looking to contribute right, not to self-host?
I didnt change anything in docker-compose.yaml , Yea im using docker plus WSL. Im looking to contribute π
ok!
could you show me the logs of your postgres container?
sure just a minute, restarting
@charles not sure why the on running the command nx run twenty-server:"database:reset" isnt working . Not sure guessing node_modules werent installed properly let me retry deleting and running yarn
Error during schema dropping: error: database "default" does not exist
at Parser.parseErrorMessage (/mnt/c/Vinays/Projects/twenty/node_modules/pg-protocol/src/parser.ts:369:69)
at Parser.handlePacket (/mnt/c/Vinays/Projects/twenty/node_modules/pg-protocol/src/parser.ts:188:21)
at Parser.parse (/mnt/c/Vinays/Projects/twenty/node_modules/pg-protocol/src/parser.ts:103:30)
at Socket.<anonymous> (/mnt/c/Vinays/Projects/twenty/node_modules/pg-protocol/src/index.ts:7:48)
at Socket.emit (node:events:514:28)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Socket.Readable.push (node:internal/streams/readable:234:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
length: 92,
severity: 'FATAL',
code: '3D000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'postinit.c',
line: '885',
routine: 'InitPostgres'
}
@Vinay could delete your docker volumes. I think the database was not properly initiated the first time and now you don't have the database default setup
Could you actually delete your docker container, it's associated volumes, re-launch it and paste the logs here?
Sure @charles , Thanks a lot for your reply
you are welcome π
This file should be executed: packages/twenty-docker/twenty-postgres/init.sql
It's used here: packages/twenty-docker/twenty-postgres/Dockerfile
it's copied within the /docker-entrypoint-initdb.d/ folder in your container and should be executed on boot
it will create a default database, if you don't have this default database it means:
- the script is not executed for some reason
- you have another postgres instance running somewhere else
I'll delete my docker container and re-launch it and run the npx nx database:reset and see if it works fine this time. Thanks for your time
great!
Still didnt work Charles, I'll try in a virtualbox linux system, hope it works there π
I see postgres was shutting down for some unknown reason maybe due to that twenty-postgres/init.sql werent executed properly i guess? twenty_postgres | postgresql 10:36:45.00 INFO ==> Starting PostgreSQL in background...
twenty_postgres | postgresql 10:36:45.15 INFO ==> Changing password of postgres
twenty_postgres | postgresql 10:36:45.17 INFO ==> Configuring replication parameters
twenty_postgres | postgresql 10:36:45.18 INFO ==> Configuring synchronous_replication
twenty_postgres | postgresql 10:36:45.19 INFO ==> Configuring fsync
twenty_postgres | postgresql 10:36:45.20 INFO ==> Stopping PostgreSQL...
twenty_postgres | waiting for server to shut down.... done
twenty_postgres | server stopped
twenty_postgres | postgresql 10:36:45.30 INFO ==> Loading custom scripts...
twenty_postgres | postgresql 10:36:45.31 INFO ==> Loading user's custom files from /docker-entrypoint-initdb.d ...
twenty_postgres | postgresql 10:36:45.31 INFO ==> Starting PostgreSQL in background...
twenty_postgres | postgresql 10:36:45.47 INFO ==> Enabling remote connections
twenty_postgres | postgresql 10:36:45.48 INFO ==> Stopping PostgreSQL...
twenty_postgres | waiting for server to shut down.... done
twenty_postgres | server stopped
twenty_postgres | postgresql 10:36:45.58 INFO ==> PostgreSQL setup finished!
twenty_postgres |
twenty_postgres | postgresql 10:36:45.60 INFO ==> Starting PostgreSQL
twenty_postgres | 2024-07-28 10:36:45.609 GMT [1] LOG: pgaudit extension initialized
twentypostgres | 2024-07-28 10:36:45.616 GMT [1] LOG: starting PostgreSQL 15.5 on x86
Hey @Vinay did you find any fix for this? I am facing the same issues
No @Sachin Mittal , instead i did set it up on kali-linux using virtual box
Update: Worked for me, I was running
make
cmd out of the root folderglad to hear u made the progress π