Wasp can't run PostgreSQL dev database for you since port 5432 is already in use.
When i do wasp start db, it gives the following error
How come that, could i be a different wasp project that i also had which took that port?
9 Replies
Hi @Sven. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, it's possible that the port 5432 is already occupied by another Wasp app or some other process. When Wasp runs a managed dev database (e.g., via
wasp start db
), it will run it on port 5432 by default. If that port is already in use, starting the database will fail [source (https://github.com/wasp-lang/wasp/issues/1049)].
To check what is running on port 5432, you can use the command lsof -i tcp:5432
[source (https://discord.com/channels/686873244791210014/1179895919471247490)].
Currently, Wasp does not provide an out-of-the-box solution to specify a different port for the managed dev database. However, there are discussions about potential solutions, such as offering the user the ability to specify on which port the managed dev database should start, or having Wasp automatically try different ports until one of them is free [source (https://github.com/wasp-lang/wasp/issues/1049)].
In the meantime, you can manually stop the process that is occupying port 5432 or use a different port for that process to free up port 5432 for Wasp.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?SOLVED!
It was docker running on that port from a different project.
@martinsos For when you get back from vacation.
Don't know if we've already considered this, but 5432 is PSQL server's default port and is bound to cause clashes with most of the folks that use Postgres for other projects.
Would we be better off running
wasp start db
on a different port?
@Sven Thanks for the report!No worries, maybe post questoins to often but when i solve them i try to explain how i did such that other community members can learn from it!
@Wasp Team what to do if I want to work with two different projects at same time?? Any way to change the port number??
Wohooo @Mrr, you just became a Waspeteer level 2!
Nope, not at the moment! You could set up your own local postgres database though and use that as a database -> so without
wasp start db
as help. We will add cusotmization of port for wasp start db
but not yet there.
@sodic I added the suggestion to https://github.com/wasp-lang/wasp/issues/1049 . It makes sense although I would be tempted then to solve it properly.Even for when we solve it properly (allow configuring the port), I'd still vote for a different default than 5432 🙂
Makes sense to me! I guess I just copied the PG behaviour, but now when you say it, I don't see why it would have to be 5432. Ok maybe in general because by default tools that work with pg like pgadmin would expect it on port 5432. But that doesn't feel like good enough argument and this is not a "default" postgres db but a quiet specific one so specific port makes sense, yeah.