Deploying Manually
I followed this guide: https://gist.github.com/infomiho/80f3f50346566e39db56c5e57fefa1fe
Unfortunately, when I try to signup, it returns 500. Here is the docker log for it:
POST /auth/email/signup 500 53.781 ms - 148
PrismaClientKnownRequestError:
Invalid
--------+--------------------+-------+---------- public | _prisma_migrations | table | postgres I followed the guide carefully, I can access the web app, just cannot login or signup. Not sure what is the issue here? Isn't wasp build creating tables and running migrations itself?
prisma.authIdentity.findUnique()
invocation:
I connected to postgres database from SSH and \dt returns the following:
List of relations
Schema | Name | Type | Owner--------+--------------------+-------+---------- public | _prisma_migrations | table | postgres I followed the guide carefully, I can access the web app, just cannot login or signup. Not sure what is the issue here? Isn't wasp build creating tables and running migrations itself?
5 Replies
Hi @neogeofun. 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 in the knowledge sources, it appears that your issue is related to database migrations not being applied correctly. Let's address this step by step:
1. Database Tables Missing:
The fact that you only see the
_prisma_migrations
table when you run \dt
in your PostgreSQL database indicates that the necessary tables for your application (like User, Auth, etc.) have not been created. This explains why you're getting a 500 error when trying to sign up.
2. Migrations Not Applied:
Wasp should typically run migrations automatically during deployment, but in some cases, this might not happen correctly. As mentioned in the Discord support thread, the error "π This error can happen if you didn't run the database migrations" suggests that the migrations were not applied.
3. Solution:
To resolve this issue, you need to manually run the database migrations. Here are the steps you can try:
a. First, ensure that your DATABASE_URL
environment variable is correctly set on your deployment platform (e.g., Fly.io).
b. Run the database migration command. As suggested in the Discord support thread, you can use:
Replace <your_database_url>
with your actual database URL.
c. After running the migration, redeploy your application.
4. Automatic Migrations:
For future deployments, you might want to consider adding a release_command
to your deployment configuration to ensure migrations are run automatically. This was mentioned in the Discord support thread as well.
5. Checking Migrations:
After applying the migrations, you can connect to your database again and run \dt
to verify that all the necessary tables have been created.
If you continue to face issues after following these steps, you might want to check your database connection settings and ensure that your application has the correct permissions to access and modify the database.
Remember, it's crucial to handle database migrations carefully, especially in production environments. Always backup your data before running migrations on a production database.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @neogeofun, 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?Yeah, I put migrations in .gitignore for some reason... Let me try rebuilding with that.
@neogeofun good luck, let us know if you get stuck π
@miho thanks, turns out it was just that for now.
I will probably send a couple of updates for the manual deploy guide sometime this week.
Sweet, let us know π