W
Waspβ€’6mo ago
fred-123

Getting stuck at Setting up database after configuring external postgresdb

I am in dev and have entered a postgresql hosted with supabase in .env.server. I have tested the connectoin through terminal and it works without problem. I ran the following commands: rm -r migrations/ wasp clean wasp db migrate-dev at the last command it always gets stuck at the step: 🐝 --- Setting up database... ----------------------------------------------------- What am i doing wrong? I have the default lines in main.wasp: db: { system: PostgreSQL, // Run wasp db seed to seed the database with the seed functions below: seeds: [ // Populates the database with a bunch of fake users to work with during development. import { devSeedUsers } from "@src/server/scripts/usersSeed.js", ] },
8 Replies
kapa.ai
kapa.aiβ€’6mo ago
Hi @fred-123. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided, it seems like you've done the correct steps to set up your database. However, there are a few things you could check: 1. Ensure that your .env.server file is correctly set up with the correct DATABASE_URL for your Supabase PostgreSQL database. 2. Make sure that your database is accessible from the machine where you're running the wasp db migrate-dev command. You mentioned that you've tested the connection through the terminal and it works, so this is likely not the issue. 3. There could be an issue with the wasp db migrate-dev command itself. There have been reported issues where the command hangs or fails with certain configurations. For example, one user reported a similar issue when running the command on an EC2 instance with limited memory (source (https://discord.com/channels/686873244791210014/1217483832404611195)). 4. There was also a reported issue where wasp start claimed the database setup was successful even when it couldn't connect to the database (source (https://github.com/wasp-lang/wasp/issues/1061)). This issue was reportedly solved by solving another issue (#1051), so it might be worth checking if this could be affecting your situation. 5. Another user reported success with using a Supabase database via DATABASE_URL (source (https://github.com/wasp-lang/wasp/issues/1265)), so it should be possible to use an external PostgreSQL database with Wasp. If you're still having issues, it might be worth reaching out to the Wasp community for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @fred-123, 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?
fred-123
fred-123OPβ€’6mo ago
@kapa.ai what are the db requirements? I am currently using free supabase for testing.
kapa.ai
kapa.aiβ€’6mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Wasp supports two types of databases: SQLite and PostgreSQL. SQLite is the default database used by Wasp and is great for getting started with a new project because it doesn't require any configuration. However, Wasp can only use SQLite in development. Once you want to deploy your Wasp app to production, you'll need to switch to PostgreSQL (source (https://wasp-lang.dev/docs/data-model/backends)). For PostgreSQL, you need to provide the server with the correct DATABASE_URL environment variable and ensure that the database is accessible from the server (source (https://wasp-lang.dev/docs/advanced/deployment/manually#4-deploying-the-database)). If you're using Supabase, you should be able to find the DATABASE_URL in the settings of your Supabase project. You can then set this DATABASE_URL in the .env.server file in the root directory of your Wasp project (source (https://wasp-lang.dev/docs/data-model/backends#connecting-to-a-database)). In terms of specific requirements, as long as your PostgreSQL database is accessible and you've set the correct DATABASE_URL, there shouldn't be any specific requirements or limitations for using a Supabase PostgreSQL database with Wasp. However, you should be aware of any limitations or restrictions that come with the free tier of Supabase, such as limits on the number of rows or the amount of storage. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @fred-123, 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?
fred-123
fred-123OPβ€’6mo ago
@kapa.ai what is the correct format for DATABASE_URL
kapa.ai
kapa.aiβ€’6mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The DATABASE_URL should be in the following format:
postgresql://mydbuser:mypass@localhost:5432/nameofmydb
postgresql://mydbuser:mypass@localhost:5432/nameofmydb
Here's what each part means: - postgresql:// is the scheme and specifies that you're connecting to a PostgreSQL database. - mydbuser: is the username for your database. - mypass@ is the password for your database. - localhost: is the hostname of your database. If your database is on the same machine where you're running your Wasp app, you can use localhost. If your database is on a different machine, replace localhost with the IP address or hostname of that machine. - 5432/ is the port number your database is listening on. PostgreSQL's default port number is 5432, but this could be different depending on your configuration. - nameofmydb is the name of your database. So, if you're using a Supabase PostgreSQL database, you'll need to replace mydbuser, mypass, localhost, 5432, and nameofmydb with the actual values for your database (source (https://wasp-lang.dev/docs/advanced/deployment/manually#environment-variables)). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @fred-123, 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?
fred-123
fred-123OPβ€’6mo ago
I just deployed to fly.io without the database_url and let it handle it automatically during deployment and it worked like a charm.
MEE6
MEE6β€’6mo ago
Wohooo @fred-123, you just became a Waspeteer level 3!
miho
mihoβ€’6mo ago
Nice πŸ‘ for me the connection to Supabase worked as well for this app https://github.com/wasp-lang/lazy-card-generator I just put in the URL like this:
DATABASE_URL=postgres://postgres.<project-id>:p<password>@aws-0-eu-central-1.pooler.supabase.com:5432/postgres
DATABASE_URL=postgres://postgres.<project-id>:p<password>@aws-0-eu-central-1.pooler.supabase.com:5432/postgres
GitHub
GitHub - wasp-lang/lazy-card-generator: Demonstration of Wasp and S...
Demonstration of Wasp and Supabase working together, using Llama 3 and SDXL to generate greeting cards! - wasp-lang/lazy-card-generator
Want results from more Discord servers?
Add your server