Fresh install - Error: There is no datasource in the schema
Hi,
i just came back to try Wasp with v16 again.
The Problem: wasp db migrate-dev gives my the Error in the section Setting up database... : Error: There is no datasource in the schema.
You don't have any datasource defined in your schema.prisma.
I started with wasp new after installing wasp on the system. Selected 3 for saas template. With wasp db start the database is running in a seperate terminal: ready for connections. And then in the app directory wasp db migrate-dev with the error above.
I also tried wasp new with 2 selected for todo-ts. Then tried wasp db start with: using sqlite, no database needed. Then i run wasp db migrate-dev and got the same error.
I checked the schema.prisma file with the saas template and it has at the top:
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
I have copied the .env.server.example to .env.server but have not changed anything in the file.
I am running Ubuntu 24.10 Desktop and Node 22 (tested also 20 and 18 with the same result). Wasp version 0.16.2. Docker Engine 27.5.1.
Is there anything i can check to help any further? Is anybody able to replicate this issue?
Any help would be greatly appreciated. Thanks ahead
7 Replies
Hi @smilebasti. 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, I can offer some insights and suggestions regarding your issue with Wasp and the database migration error.
1. First, it's important to note that the error you're experiencing is not a common one, as it's not directly mentioned in the provided knowledge sources. However, we can draw some conclusions from similar issues and general Wasp database setup procedures.
2. The error "There is no datasource in the schema" is unusual, especially since you've confirmed that the
schema.prisma
file contains the correct datasource configuration for PostgreSQL.
3. Here are some steps you can try to troubleshoot the issue:
a. Run wasp clean
and then wasp start
again. This solution helped resolve a similar Prisma-related issue for another user, as mentioned in the Discord support thread.
b. Double-check that your .env.server
file contains the correct DATABASE_URL
. The format should be something like:
Make sure this matches the PostgreSQL instance you're running with Docker.
c. Ensure that the PostgreSQL Docker container is running and accessible. You can test the connection using a PostgreSQL client or the psql
command-line tool.
d. Try running wasp db migrate-dev
with the --create-only
flag to see if it generates the migration files without trying to apply them.
4. If the issue persists, it might be related to how Wasp is reading the environment variables or generating the Prisma schema. In this case, you may want to:
a. Check if there are any error messages in the Wasp logs that might provide more context.
b. Verify that the Prisma schema is being generated correctly in the .wasp/out/server/
directory.
c. Try creating a minimal Wasp project (not using a template) to see if the issue occurs there as well.
5. If none of the above steps resolve the issue, it might be a bug in Wasp v0.16.2. In this case, you should consider:
a. Trying an older version of Wasp to see if the issue persists.
b. Reporting the issue on the Wasp GitHub repository with all the details you've provided here, including your system information and the steps you've taken.
Remember that Wasp is actively developed, and new versions may introduce changes or fixes. Always ensure you're using the latest stable version and check the documentation for any recent updates regarding database setup and migration processes.
If you need further assistance, the Wasp Discord community is usually very helpful for troubleshooting issues like this.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @smilebasti, 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?wasp clean and then wasp start does not fix it and i get the same error.
When i test DATABASE_URL="postgresql://postgres:devpass@localhost:5432/postgres" while the database is already running i get the same error.
I checked the file .wasp/db/out/schema.prisma and its empty.
Wohooo @smilebasti, you just became a Waspeteer level 2!
As i could not find anything related i opened a github issue: https://github.com/wasp-lang/wasp/issues/2530
GitHub
Fresh install - Error: There is no datasource in the schema · Issue...
Hi, as suggested i open a issue here: https://discordapp.com/channels/686873244791210014/1344983894109454398 i just came back to try Wasp with v16 again but ran into problems. The Problem: wasp db ...
Please share your
prisma.schema
from your project root so we can see what's going on 🙂 you are sure that running wasp version
gives you 0.16.2
?
Does the following work for you:
- curl -sSL https://get.wasp.sh/installer.sh | sh -s
- wasp version
gives 0.16.2
- wasp new test-prisma -t todo-ts
- cd test-prisma
- wasp db migrate-dev
- wasp start
Thank you for your response. I have tried it but i got the same output...


Could you please zip the _whole project dir including nodemodules and send it to me here? e.g. upload it here https://www.transfernow.net/en
TransferNow
Send Large Files - Free Secure File Transfer - TransferNow
TransferNow is a simple, quick and secure free solution to send large files and big documents up to 250 GB per transfer. No registration required.