W
Wasp•2mo ago
smilebasti

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
14 Replies
kapa.ai
kapa.ai•2mo ago
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:
DATABASE_URL="postgresql://postgres:devpass@localhost:5432/postgres"

DATABASE_URL="postgresql://postgres:devpass@localhost:5432/postgres"

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?
smilebasti
smilebastiOP•2mo ago
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.
MEE6
MEE6•2mo ago
Wohooo @smilebasti, you just became a Waspeteer level 2!
smilebasti
smilebastiOP•2mo ago
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 ...
miho
miho•2mo ago
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
smilebasti
smilebastiOP•2mo ago
Thank you for your response. I have tried it but i got the same output...
No description
No description
miho
miho•2mo ago
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.
smilebasti
smilebastiOP•2mo ago
TransferNow
test-prisma.zip is available for download
Click to access the test-prisma.zip (139 MB) download with TransferNow
miho
miho•2mo ago
I downloaded your project, and I first got this error:
No description
miho
miho•2mo ago
Then I ran wasp clean and wasp start and everything worked This is so weird... I can't seem to reproduce the error you have. I can see you have datasource in the Prisma file
miho
miho•2mo ago
In the out dir, the Prisma file is empty, but wasp clean helped with that. Hm... I'm not sure what could cause this for you. If Wasp CLI can't parse the Prisma file - Wasp CLI fails to start, but it has to be something with parsing of the Prisma file.
No description
miho
miho•2mo ago
Could you share your system details, which laptop, which OS, which processor architecture?
smilebasti
smilebastiOP•2mo ago
Its pretty clean, standard and new installation of Ubuntu 24.10 Desktop. I installed node with the the Ubuntu appstore. I will try to install it the normal way System Details Report --- Report details - Date generated: 2025-03-03 16:25:28 Hardware Information: - Hardware Model: FUJITSU D3162-B1 - Memory: 16.0 GiB - Processor: Intel® Core™ i5-3470 × 4 - Graphics: AMD Radeon™ RX 570 Series - Disk Capacity: 1.2 TB Software Information: - Firmware Version: V4.6.5.3 R1.23.0 for D3162-B1x - OS Name: Ubuntu 24.10 - OS Build: (null) - OS Type: 64-bit - GNOME Version: 47 - Windowing System: Wayland - Kernel Version: Linux 6.11.0-14-generic I uninstalled node with the Ubuntu appstore and then installed nvm. Installed node with nvm install --lts which install node v22.14.0 and npm v10.9.2. I then ran wasp clean and wasp db migrate-dev and it worked 🎉 Thank for your help 🙂
miho
miho•2mo ago
Ooof I didn’t expect that to be a problem. Thank you for figuring it out!

Did you find this page helpful?