DB wont setup
Man, anyone got some tips for getting my db up and running again. wasp db migrate-dev just hangs.
20 Replies
Hi @Guerilla. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry to hear that you're having trouble with setting up your database using
wasp db migrate-dev
. Here are a few steps you can try based on the information from the knowledge sources:
1. Check the output: If there's any output before it hangs, it might include clues as to why it's hanging. For example, it might be waiting for a prompt.
2. Try building the SDK directly: If it hangs during the "Building SDK" stage, you can try to build the SDK directly. Here's how you can do it:
3. Interrupt the hanging command: If you can't Ctrl+C wasp db migrate-dev
because it stops reading your input, you can still interrupt it by sending the Ctrl+C signal from a different terminal. Here's how:
At this point, use any of the terminals to execute npx tsc
in .wasp/out/sdk/wasp
.
If none of these steps work, there might be an issue with the Wasp framework itself. In that case, you might want to report the issue on the Wasp Github page (https://github.com/wasp-lang/wasp/issues).
Please note that these steps are based on the information from the knowledge sources (https://discord.com/channels/686873244791210014/1217483832404611195) and might not solve your specific issue. If you're still having trouble, I recommend reaching out to the Wasp community for more specific help.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Guerilla, 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?(base) ➜ app git:(master) ✗ wasp db migrate-dev
🐝 --- Compiling wasp project... --------------------------------------------------
✅ --- Successfully completed npm install. ----------------------------------------
🐝 --- Setting up database... -----------------------------------------------------
It hangs here, should i delete the db entirely?
What kind of DB are you using, Postgres or Sqlite?
Are you running the DB with the
wasp start db
?Postgres, and no - I am managing the DB myself as I have other psql dbs running :).
Fedora 37
0.13.2 wasp
psql 14.9
You've setup the
DATABASE_URL
in the .env.server
correctly? With the host, username, pw and the db name?I had an issue with the schema possibly, so it asked me if I wanted to lose all my data etc..
Wohooo @Guerilla, you just became a Waspeteer level 1!
So I said yes
IMHO if you can, drop the DB and delete the
migrations
folder and run wasp clean
to clean up. Then see if it works with a clean startOk, will it create the DB or no
When its not managed
It won't create the DB if I recall correctly 😄 that's something @sodic discovered since he manages his DBs on Linux as well
I'll let him chime in when he can, but try creating a DB and let's see what happens
ERROR: database "wasp_recipes" is being accessed by other users
DETAIL: There are X other sessions using the database.
postgres=#
Hmm. Thats probably the problem lmao
LMfao.. yeeeerp
Sorry, there was 25 Idk why I blanked that one out. Thanks 😄
there was 25 Idk why I blanked that one out.25 active sessions? I didn't quite get this 😄 I'm glad it worked out
It will by default, unless you do something weird with jobs.
We have an edge case that manifests in some apps (e.g. Open Saas), but by design, Wasp should create a misaing database.
So of that doesn't happen, please give us more details 😅
Yeah, im using Open Saas 😛
@Guerilla I didn't quite get it, what was the issue at the end? Anything we could have done from our side to prevent it?
Hi @Guerilla
Maybe wasp is unable to connect to your db because of credentials, assuming you db server is running.
If its the case you can di the following:
1. to copy the env variables you will need and in the DATABASE_URL you assign the url to connect to your db, ex:
postgresql://user:password@localhost:5432/db_name
2. to make the necessary changes in db.
3. optionally you can run to preview you db and tables and its data when you have some.
Yeah Idk what happened to be honest. It wasn't credentials, I tried doing a prisma-migrate, and it just borked.
Once I tried droping it, it told me I had 25 connections to it, so I couldn't.
Honestly having mroe issues with wasps integration of prisma than time save, is there a way to run prisma natively and benefit from the Entity structure that wasp offers?
Wohooo @Guerilla, you just became a Waspeteer level 2!
We are working on pulling Prisma out of main.wasp file, while still having the concept of entities, but it will take a month or two for that to be released.
You had this problem with connecting to the database -> anything else you had trouble with?
I think most people use
wasp db start
which kind of makes handling dev database really easy.