W
Wasp-lang•2w ago
Sven

When trying to perform a database action i get network error. Also when trying to register

When i try to perform a database action or register an account i get network error. I did
wasp start db
wasp start db
PostgreSQL Database directory appears to contain a database; Skipping initialization

2024-09-10 16:27:54.750 UTC [1] LOG: starting PostgreSQL 14.4 (Debian 14.4-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2024-09-10 16:27:54.751 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-09-10 16:27:54.751 UTC [1] LOG: listening on IPv6 address "::", port 5432
2024-09-10 16:27:54.757 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-09-10 16:27:54.766 UTC [26] LOG: database system was shut down at 2024-09-10 16:27:48 UTC
2024-09-10 16:27:54.773 UTC [1] LOG: database system is ready to accept connections
PostgreSQL Database directory appears to contain a database; Skipping initialization

2024-09-10 16:27:54.750 UTC [1] LOG: starting PostgreSQL 14.4 (Debian 14.4-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2024-09-10 16:27:54.751 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-09-10 16:27:54.751 UTC [1] LOG: listening on IPv6 address "::", port 5432
2024-09-10 16:27:54.757 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-09-10 16:27:54.766 UTC [26] LOG: database system was shut down at 2024-09-10 16:27:48 UTC
2024-09-10 16:27:54.773 UTC [1] LOG: database system is ready to accept connections
When i do
wasp db studio
wasp db studio
the prisma thingy opens and i see all the tables.
7 Replies
kapa.ai
kapa.ai•2w ago
Hi @Sven. 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 your PostgreSQL database is running correctly as indicated by the logs. However, you're experiencing a network error when trying to perform a database action or register an account. This issue might be related to the connection between your application and the database. Here are a few things you could check: 1. Database Connection String: Ensure that the connection string in your .env file is correct. It should look something like this: DATABASE_URL="postgresql://postgres:devpass@localhost:5432/postgres". 2. Database Server: Make sure your database server is running at localhost:5432. You can check this by running the command docker info and docker -v to ensure Docker is installed and running, as Docker is used to run the PostgreSQL database. 3. Prisma Client: There might be an issue with the Prisma Client. One of the issues mentioned was about an error in Prisma Client request, where the query engine binary for the current platform could not be found. This usually happens when Prisma Client is built on a different platform. To solve this, you can add the platform "undefined" to the "generator" block in the "schema.prisma" file and then run "prisma generate" for your changes to take effect. If you're still experiencing issues, it might be helpful to provide more details about the exact error message you're seeing when trying to perform a database action or register an account. Sources: - Github Issue (closed): Wasp db studio not working? (https://github.com/wasp-lang/wasp/issues/228) - Github Issue (closed): Realworld app returning Network Error (https://github.com/wasp-lang/wasp/issues/460) - Discord support thread: "wasp start db" takes too much time. (https://discord.com/channels/686873244791210014/1223569423177089093) ---------------------- 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?
Sven
Sven•2w ago
# NOTE: you can let Wasp set up your Postgres DB by running `wasp start db` in a separate terminal window.
# then, in a new terminal window, run `wasp db migrate-dev` and finally `wasp start`.
# If you use `wasp start db` then you DO NOT need to add a DATABASE_URL env variable here.
# NOTE: you can let Wasp set up your Postgres DB by running `wasp start db` in a separate terminal window.
# then, in a new terminal window, run `wasp db migrate-dev` and finally `wasp start`.
# If you use `wasp start db` then you DO NOT need to add a DATABASE_URL env variable here.
why is this on the top of the .env example file? @kapa.ai
kapa.ai
kapa.ai•2w ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The note at the top of the .env example file is providing instructions on how to set up your database when using Wasp. Here's a breakdown of what each part means: - wasp start db: This command starts a default PostgreSQL development database for you. Your Wasp app will automatically connect to it, so you just need to keep this command running in the background. This is a convenient feature as you don't need to set up your own database or provide its connection URL to the Wasp app. - wasp db migrate-dev: This command synchronizes the development database with the current state of your schema (entities). If there are any changes in the schema, it generates a new migration and applies any pending migrations to the database. - wasp start: This command launches the Wasp app in development mode. It automatically opens a browser tab with your application running and watches for any changes to .wasp or files in src/ to automatically reflect in the browser. - DATABASE_URL env variable: If you're not using the wasp start db command (i.e., you're connecting to an existing database or spinning up your own dev database), you need to tell Wasp about it using the DATABASE_URL environment variable. Wasp will use the value of DATABASE_URL as a connection string. However, if you're using wasp start db, you don't need to add this variable, as Wasp will handle the connection for you. The note is there to guide you on how to set up your database and start your Wasp app, depending on whether you're using Wasp's default database or your own. Sources: - Wasp Docs: Connecting to a Database (https://wasp-lang.dev/docs/data-model/backends#connecting-to-a-database) - Wasp Docs: CLI Reference (https://wasp-lang.dev/docs/general/cli#project-commands) ---------------------- 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?
Sven
Sven•2w ago
I did all this, in docker a container is running. I did the migrate then did
wasp start
wasp start
but still when i try to register i get network error @Wasp Team
Milica
Milica•2w ago
@Sven Please keep in mind that we're a small team, and we will answer you as soon as we can. Overusing pinging the whole team isn't going to help you.
Sven
Sven•2w ago
Ohhh sorry, i thought i manually had to ping. Was not my intention to over rush u Sorry I will stop pinging then I totally understand SOLVED!
the problem was that i didnt have a env variable set.

1. change remove .example from the .env filenames
2. add a stripe test api key that starts with sk see:

https://dashboard.stripe.com/test/apikeys and get a test
the problem was that i didnt have a env variable set.

1. change remove .example from the .env filenames
2. add a stripe test api key that starts with sk see:

https://dashboard.stripe.com/test/apikeys and get a test
Vinny (@Wasp)
Vinny (@Wasp)•2w ago
awesome. nice work glad you got it solved 🙂
Want results from more Discord servers?
Add your server