W
Wasp-langβ€’2mo ago
beechain

change what port wasp is listening on

hey all looking for some help - i am on linux system if relevant (inb4 i use linux) really simple i think - starting up my wasp app for first time, i cant
wasp db migrate-dev
wasp db migrate-dev
because
[ Db !] Can't reach database server at `localhost`:`5432`
[ Db !]
[ Db !] Please make sure your database server is running at `localhost`:`5432`.
[ Db !] Can't reach database server at `localhost`:`5432`
[ Db !]
[ Db !] Please make sure your database server is running at `localhost`:`5432`.
i think i started my DB on localhost:4000 - any way i can get the wasp app/wasp start/db to listen on port 4000 instead? i tried checking the env server/ env client files but didnt see anything there, maybe its somewhere else to change where im listening to for the db? does this make sense yall? ty for help πŸ™
8 Replies
kapa.ai
kapa.aiβ€’2mo ago
Hi @beechain. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, your question makes sense. Currently, Wasp does not provide a built-in way to change the port on which the database is running. The port is hardcoded to 5432 and there is no configuration option to change it. This is a known issue and there are open discussions on GitHub about allowing the user to specify a different port for the managed dev database (source (https://github.com/wasp-lang/wasp/issues/1049)) and for the Wasp development server (source (https://github.com/wasp-lang/wasp/issues/730)). However, there are some workarounds you can try: 1. Change the DATABASE_URL environment variable: You can try setting the DATABASE_URL environment variable to point to your database running on port 4000. This variable is used to specify the connection string for the database. You would set it to something like postgresql://localhost:4000/mydatabase. This was suggested in a Discord support thread (https://discord.com/channels/686873244791210014/1179895919471247490). 2. Stop any other process using port 5432: If there is another process (like a local Postgres instance) using port 5432, you could stop that process to free up the port. This was also suggested in the same Discord support thread (https://discord.com/channels/686873244791210014/1179895919471247490). Please note that these are just workarounds and may not work in all situations. The Wasp team is aware of this limitation and is working on a more flexible solution. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @beechain, 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?
martinsos
martinsosβ€’2mo ago
Right, so you need a database running. First way to do that is by running wasp db start so wasp will run it for you. leave it running in seprate terminal window and you should be good. Second way is to run it on your own, but then you need to specify DATABASE_URL in .env.server. you will also speicfy the port there as part of the URL. You mentioned you think you ran a database on port 4000. First, it would be great if you were sur eabout that :D. SEcond, if you want to use that database, you should obtain its connection URL that has db name, user name, password, port, and then set that as DATABASE_URL. Or, just go with wasp db start. Check out the docs here for more info: https://wasp-lang.dev/docs/data-model/backends
Databases | Wasp
Entities, Operations and Automatic CRUD together make a high-level interface for working with your app's data. Still, all that data has to live somewhere, so let's see how Wasp deals with databases.
beechain
beechainβ€’2mo ago
hey martinsos, i did the wasp db start thing you mentioned - im listening on 5432 now. but i get this when error when i wasp db migrate-dev
[ Wasp ] tsconfig.json(2,14): error TS6053: File '@tsconfig/node18/tsconfig.json' not found.
[ Wasp ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(1,23): error TS2688: Cannot find type definition file for 'jest'.
[ Wasp ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(9,27): error TS2304: Cannot find name 'expect'.
[ Wasp ] ../../../../node_modules/vitest/node_modules/vite/dist/node/index.d.ts(5,41): error TS2307: Cannot find module 'rollup/parseAst' or its corresponding type declarations.
[ Wasp ] There are types at '/home/bee/bookme/app/node_modules/vitest/node_modules/rollup/dist/parseAst.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
[ Wasp ] tsconfig.json(2,14): error TS6053: File '@tsconfig/node18/tsconfig.json' not found.
[ Wasp ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(1,23): error TS2688: Cannot find type definition file for 'jest'.
[ Wasp ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(9,27): error TS2304: Cannot find name 'expect'.
[ Wasp ] ../../../../node_modules/vitest/node_modules/vite/dist/node/index.d.ts(5,41): error TS2307: Cannot find module 'rollup/parseAst' or its corresponding type declarations.
[ Wasp ] There are types at '/home/bee/bookme/app/node_modules/vitest/node_modules/rollup/dist/parseAst.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
any advice around this? or places u can refer me to? something with my ts not being up to date? i have node v18.19, so i dont think the node16 needs to be updated
MEE6
MEE6β€’2mo ago
Wohooo @beechain, you just became a Waspeteer level 1!
beechain
beechainβ€’2mo ago
pls & ty^ @martinsos or other admin help plz
martinsos
martinsosβ€’2mo ago
Yup yup I am here! Hm, can you show me the rest of theoutput you get before this error message? Please let me know what node --version tells you. I know you wrote 18.19 but just to double check. Also, try doing waap clean and then running wasp start again. Finally, if that didn't help, try switching to node 20 (e.g using nvm) and also do wasp clean and then wasp start and see if that helps. If any of these helps, please let me know exactly which step helped, it will help us identify the initial issue!
beechain
beechainβ€’2mo ago
yooooo lfg ty martinsos πŸ”₯ yup cleaned and started again, it took a few tries, but node 20 via nvm helped
martinsos
martinsosβ€’2mo ago
Awesome! Sorry that it happens at all, we are looking into that will be doing a refactor that should minimize occurences like this.
Want results from more Discord servers?
Add your server