W
Waspβ€’2mo ago
sib._.

no datasource in schema and schema.prisma empty in .wasp

hi, I've been trying to get wasp to compile with just fresh starter projects or the saas template. However, for the last three days I have been running into the same error and it's driving me insane! I have tried: different version of wasp, of node; fresh installs of wasp and running wasp new; sqlite and postgresql. I have used wasp before and deployed using fly.io especially using version 0.16.0 and wanted to check out 0.18.0 before doing a migration. once again after starting the db by running "wasp start db" it runs using postgresql next when I run "wasp db migrate-dev" or "wasp compile" I get the following output: any help is appreciated! """ 🐝 --- Compiling wasp project... -------------------------------------------------- βœ… --- Successfully completed npm install. ---------------------------------------- 🐝 --- Setting up database... ----------------------------------------------------- [ Db !] Error: There is no datasource in the schema. [ Db !] [ Db !] [ Db ] Environment variables loaded from .env [ Db ] Prisma schema loaded from ../db/schema.prisma [ Db !] Error: [ Db !] You don't have any datasource defined in your schema.prisma. [ Db !] You can define a datasource like this: [ Db !] [ Db !] datasource db { [ Db !] provider = "postgresql" [ Db !] url = env("DB_URL") [ Db !] } [ Db !] [ Db !] More information in our documentation: [ Db !] https://pris.ly/d/prisma-schema [ Db !] ❌ --- [Error] Your wasp project failed to compile: ------------------------------- - Prisma client generation failed with exit code: 1 ❌ --- [Error] Compilation of wasp project failed: -------------------------------- 1 errors found """
58 Replies
kapa.ai
kapa.aiβ€’2mo ago
Hi @sib._.. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry you're running into this frustrating issue! Based on your error message:
[ Db !] Error: There is no datasource in the schema.
...
[ Db !] You don't have any datasource defined in your schema.prisma.
[ Db !] Error: There is no datasource in the schema.
...
[ Db !] You don't have any datasource defined in your schema.prisma.
This means that the generated schema.prisma file in your Wasp project's .wasp/out/db/ directory is empty or missing the datasource block. Normally, Wasp generates this file for you based on your main.wasp configuration and any defined entities. Possible causes and troubleshooting steps: 1. No Entities Defined in main.wasp:
If you don't have any entities defined in your main.wasp, Wasp may generate an empty or incomplete Prisma schema, leading to this error. Try adding at least one dummy entity to your main.wasp file, for example:
entity Dummy {=psl
id Int @id @default(autoincrement())
psl=}

entity Dummy {=psl
id Int @id @default(autoincrement())
psl=}

Then run wasp db migrate-dev again. This workaround has been suggested for similar issues in the past and can help the Prisma schema generation process proceed correctly Github Issue #398. 2. Corrupted or Incomplete Project State:
Sometimes, the build artifacts or generated files can get into a bad state. Try running:
wasp clean
wasp db migrate-dev

wasp clean
wasp db migrate-dev

This will clean out generated files and force Wasp to regenerate everything from scratch. This has resolved similar issues for other users Discord thread. 3. Check main.wasp for db Provider:
Ensure your main.wasp file includes a db block specifying the provider, e.g.:
db { provider: "postgres" }

db { provider: "postgres" }

If this is missing, Wasp may not generate the correct datasource in schema.prisma Github Issue #173. 4. Do Not Manually Edit schema.prisma:
You should not manually edit the generated schema.prisma file. Wasp manages this file based on your main.wasp configuration Discord thread. Summary:
- Add at least one entity to your main.wasp. - Make sure the db provider is set. - Run wasp clean and try again. If after these steps the problem persists, please share your main.wasp file (with sensitive info removed) and any additional error output. There may be a deeper issue, but these steps resolve the most common causes based on the knowledge sources. Let me know how it goes! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speechballoon: ---------------------- Sorry @sib.., 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?
sib._.
sib._.OPβ€’2mo ago
@kapa.ai still not working can you investigate '- Prisma client generation failed with exit code: 1'
kapa.ai
kapa.aiβ€’2mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Based on the knowledge sources, the error message:
- Prisma client generation failed with exit code: 1
- Prisma client generation failed with exit code: 1
is typically caused by issues with the generated schema.prisma file, most often when it is missing a datasource block or is empty. This can happen if: - No entities are defined in your main.wasp file, which leads to Wasp generating an empty or incomplete Prisma schema. The workaround is to define at least one dummy entity in your main.wasp file and then run wasp db migrate-dev again. This has been confirmed as a fix in previous issues Github Issue #398. - The db block specifying the provider (e.g., postgres or sqlite) is missing from your main.wasp file, which prevents Wasp from generating the correct datasource in schema.prisma Github Issue #248. If you have already tried adding a dummy entity and ensured the db block is present, but the error persists, there may be a deeper issue with how Wasp is generating or handling the Prisma schema. The knowledge sources do not provide a definitive solution beyond these steps. Additionally, running wasp clean before trying again has resolved similar issues for other users, as it forces regeneration of all build artifacts and dependencies Discord support thread. If none of these steps resolve the issue, the knowledge sources do not contain enough information to provide a more specific solution. In that case, sharing your main.wasp file and the full error output with the Wasp community or opening a GitHub issue may help identify the root cause. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speechballoon: ---------------------- Sorry @sib.., 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?
genyus
genyusβ€’2mo ago
@sib._. Can you share your prisma.schema file?
sib._.
sib._.OPβ€’2mo ago
here @genyus generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model User { id Int @id @default(autoincrement()) tasks Task[] } model Task { id Int @id @default(autoincrement()) description String isDone Boolean @default(false) user User @relation(fields: [userId], references: [id]) userId Int } sorry for the late reply was cooking @kapa.ai I've tried this and it does not work at all still
kapa.ai
kapa.aiβ€’2mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I'm sorry to hear that the previous steps did not resolve your issue. Based on the knowledge sources, the error:
- Prisma client generation failed with exit code: 1
- Prisma client generation failed with exit code: 1
is most commonly linked to problems with the generated schema.prisma fileβ€”specifically, it being empty or missing a datasource block. This typically happens if there are no entities defined in your main.wasp file, or if the db block is missing or misconfigured. Adding a dummy entity and ensuring the db block is present are the main recommended solutions, and running wasp clean has helped some users in similar situations. However, since you have already tried these steps and the problem persists, I must state that the knowledge sources do not contain enough information to provide a more specific or advanced solution for your case. There is no documented fix beyond what has already been suggested, and no deeper troubleshooting steps are available in the provided sources. If you are still encountering this error after following all the recommended steps, the best course of action would be to share your main.wasp file and the full error output with the Wasp community or to open a GitHub issue, as your situation may require direct investigation by the maintainers or more context-specific troubleshooting. I'm sorry I can't provide a more definitive answer based on the current knowledge sources. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speechballoon: ---------------------- Sorry @sib.., 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?
genyus
genyusβ€’2mo ago
The file looks fine. Can you run wasp clean and then compile again. If you get the same error, please share your .wasp/out/db/schema.prima file
sib._.
sib._.OPβ€’2mo ago
it's there but empty
MEE6
MEE6β€’2mo ago
Wohooo @sib._., you just became a Waspeteer level 1!
sib._.
sib._.OPβ€’2mo ago
the schema.prisma file is present in the folder .wasp/out/db/ however there is nothing inside of it, it is just blank
genyus
genyusβ€’2mo ago
Well, that explains the error, although the question is why it's not being populated. Could you run wasp compile > log.txt 2>&1 and then share the log.txt file here, please? Also, you said you've been trying different Node versions, what is the current?
sib._.
sib._.OPβ€’2mo ago
[ Db !] Error: There is no datasource in the schema. [ Db !] [ Db !]  🐝 --- Compiling wasp project... --------------------------------------------------   βœ… --- Successfully completed npm install. ----------------------------------------   🐝 --- Setting up database... -----------------------------------------------------  [ Db ] Environment variables loaded from .env [ Db ] Prisma schema loaded from ../db/schema.prisma [ Db !] Error: [ Db !] You don't have any datasource defined in your schema.prisma. [ Db !] You can define a datasource like this: [ Db !] [ Db !] datasource db { [ Db !] provider = "postgresql" [ Db !] url = env("DB_URL") [ Db !] } [ Db !] [ Db !] More information in our documentation: [ Db !] https://pris.ly/d/prisma-schema [ Db !]  ❌ --- [Error] Your wasp project failed to compile: ------------------------------- - Prisma client generation failed with exit code: 1  πŸ‘€ --- [Warning] Your wasp project reported following warnings during compilation: --- - Wasp was unable to verify your database is up to date. Running wasp db migrate-dev may fix this and will provide more info.  ❌ --- [Error] Compilation of wasp project failed: -------------------------------- 1 errors found right now I'm using node 22.20.0
sib._.
sib._.OPβ€’2mo ago
here is the file
genyus
genyusβ€’2mo ago
Does this error only occur with your 0.18 instance? Or you're having the problem with all your local Wasp projects?
sib._.
sib._.OPβ€’2mo ago
i've tried 0.16.0, 0.17.0, 0.18.0 .... the problem indeed persists with all local wasp projects it's always the same error for various projects @genyus any ideas would be appreciated!
miho
mihoβ€’2mo ago
If you can, please share your schema.prisma file here, I suspect it's something with our Prisma parser
sib._.
sib._.OPβ€’2mo ago
here you go, this is a small one (I made for checking if changing wasp versions would fix the error, it didn't...)
sib._.
sib._.OPβ€’2mo ago
I have also tried the default schema.prisma that is generated when doing wasp new MyApp and I have also tried compiling with the schema.prisma from the saas template, all of which with no success..
miho
mihoβ€’2mo ago
Can you try doing this:
wasp new test
cd test
wasp db migrate-dev
wasp new test
cd test
wasp db migrate-dev
Does that work for you?
sib._.
sib._.OPβ€’2mo ago
I have tried this. I stil lget the exact same error "Error: There is no datasource in the schema."
MEE6
MEE6β€’2mo ago
Wohooo @sib._., you just became a Waspeteer level 2!
miho
mihoβ€’2mo ago
Please run it again so I can see the full output πŸ™‚
sib._.
sib._.OPβ€’2mo ago
here is the output
miho
mihoβ€’2mo ago
curl -sSL https://get.wasp.sh/installer.sh | sh -s
wasp new test
cd test
wasp db migrate-dev
curl -sSL https://get.wasp.sh/installer.sh | sh -s
wasp new test
cd test
wasp db migrate-dev
Run this - let's see what happens when you do it from scratch
sib._.
sib._.OPβ€’2mo ago
this will auto install wasp 18 right?
miho
mihoβ€’2mo ago
Yep The version doesn't matter that much, but I wanted to see it as from-scratch as possible
sib._.
sib._.OPβ€’2mo ago
literally the same error again.
miho
mihoβ€’2mo ago
Please copy the full output, here's mine for example:
sib._.
sib._.OPβ€’2mo ago
Here you go.
miho
mihoβ€’2mo ago
That's pretty wild πŸ˜„ I've never seen this fail like this. What is your Node.js and npm version?
sib._.
sib._.OPβ€’2mo ago
simon@zen:~/test$ node -v v22.20.0 simon@zen:~/test$ npm -v 10.9.3
miho
mihoβ€’2mo ago
Also pls share from the test project:
cat .wasp/out/db/schema.prisma
cat node_modules/.prisma/client/schema.prisma
cat .wasp/out/db/schema.prisma
cat node_modules/.prisma/client/schema.prisma
sib._.
sib._.OPβ€’2mo ago
the schema.prisma is there but completely empty. in the wasp out db bin simon@zen:~/dev/test$ cat .wasp/out/db/schema.prisma simon@zen:~/dev/test$ cat node_modules/.prisma/client/schema.prisma cat: node_modules/.prisma/client/schema.prisma: No such file or directory
miho
mihoβ€’2mo ago
I guess another question for you, what is your OS? Mac, Linux, WSL2? Is your setup specific for some reason? πŸ™‚
sib._.
sib._.OPβ€’2mo ago
Running Ubuntu 24.04 LTS It's just the stock OS installed nvm, node and wasp are all installed using apt-get wasp 0.16 was working fine on the same OS in February, I will try to run a fresh wasp project using an old laptop probably later today to see if maybe it's an OS dependent issue (long shot but still)
miho
mihoβ€’2mo ago
Ok, thank you for trying to figure it out with me!
sib._.
sib._.OPβ€’2mo ago
any idea what is going wrong on my system?
miho
mihoβ€’2mo ago
Did you do this:
I will try to run a fresh wasp project using an old laptop probably later today to see if maybe it's an OS dependent issue (long shot but still)
I'm not really sure what can go wrong, that's why I keep asking you to run things πŸ™‚ for me - it works perfectly on my Mac and on my Ubuntu 22 server
sib._.
sib._.OPβ€’2mo ago
no not yet, i just want it to run on this system, my fast larger lighter laptop..
miho
mihoβ€’2mo ago
@sodic do you mind picking this one up? I couldn't figure it out - maybe you'll have some fresh idea how to debug this?
sib._.
sib._.OPβ€’2mo ago
Any help would be appreciated as I am hard stuck on things to try
Filip
Filipβ€’2mo ago
Sure, I'll try Hey @sib.. Let me get familiar with the issue Yes, this is very strange indeed. Alright@sib.., here's what I'll need, Can you do the same thing Miho asked you to do again:
curl -sSL https://get.wasp.sh/installer.sh | sh -s
wasp new test
cd test
wasp db migrate-dev
curl -sSL https://get.wasp.sh/installer.sh | sh -s
wasp new test
cd test
wasp db migrate-dev
After you confirm the error is still there, please zip the entire project directory (including all hidden and ignored folders like .wasp and node_modules) and send it to me. My theory is that your system is somehow altering the project I'll inspect the files and see whether I can find something strange compared to a new project on my system. If not, I have some other ideas. But let's start with this
sib._.
sib._.OPβ€’2mo ago
I've dm'ed you a google drive link as the zip is around 150mb @sodic let me know if you notice anything
MEE6
MEE6β€’2mo ago
Wohooo @sib._., you just became a Waspeteer level 3!
Filip
Filipβ€’2mo ago
I'll dig into this now, thanks. I replied in your DM
sib._.
sib._.OPβ€’2mo ago
alright, thanks! update: using wasp 0.14.0 for a fresh project works on my system, there are no schema.prisma errors
Filip
Filipβ€’2mo ago
Oh man but that's old Good news, I got your error on my system
Filip
Filipβ€’2mo ago
No description
Filip
Filipβ€’2mo ago
I'll compare it with a project of my own and we'll get to the bottom of it Thanks for the patience! I'll jump back into it tomorrow and tell you what I find
sib._.
sib._.OPβ€’2mo ago
Alright, sounds good!
Filip
Filipβ€’2mo ago
Hey @sib._. I got sick. You're really out of luck with this one I'm likely back tomorrow and will dig in So, when you run wasp start or wasp db migrate-dev, Wasp copies your prisma.schema into .wasp/out/db. You and Miho correctly realized that this is where the problem occurs. You have a very short .wasp/out/db (just a single newline) and nothing at all in node_modules/.prisma/client/schema.prisma What we need to figure out is what happens during the copying When I do wasp clean on your project, everything works. So it's either something with the installed dependencies or something with your system Yes, even if I only delete .wasp, the next run works. So it's got to be something on the system We could jump on a call tomorrow if you're up for it?
sib._.
sib._.OPβ€’2mo ago
yes, sure thing! Thanks for all your effort.
Filip
Filipβ€’2mo ago
When does it work for you? I don't know your timezone, but how about 16:00 CET?
sib._.
sib._.OPβ€’2mo ago
I'm on CET too. I'm not available later today sadly, how about tomorrow morning?
Filip
Filipβ€’2mo ago
Couldn't do it today morning, how about today? Or, in the meantime, do you have access to a different machine, or a digital ocean server or something? Just so you confirm all the same steps work there for you If not, I can set one up for you Ok, can't do today anymore. But here's another thing you can try to narrow down the issue: - Try to run a wasp project as a different user and in a completely new file path (one that doesn't share any folders with the one you're trying) on the same machine - As a same user, on a different file path (e.g., in /tmp)
sib._.
sib._.OPβ€’2mo ago
I have tried to make a new root user on my system. After installing wasp 0.18.0 and the perquisites I get the exact same error!! The new user folder was created in the same directory as my primary user account. Any suggestions what can still be tried? What exactly is meant by the different file path? Do you mean creating a fresh project in a different folder then previously attempted? I have already tried to make a new project in various different directories on multiple levels.
miho
mihoβ€’2mo ago
Filip is currently on a conference in the USA so he might take some time to respond. One extra debugging tool I found about from Claude is strace, maybe you can run it and we see what's going on:
wasp new debugtest
cd debugtest

# Run with strace to see file operations
strace -f -e trace=open,openat,write,close -o /tmp/wasp-trace.log wasp db migrate-dev

# Search for schema.prisma in the trace
grep "schema.prisma" /tmp/wasp-trace.log
wasp new debugtest
cd debugtest

# Run with strace to see file operations
strace -f -e trace=open,openat,write,close -o /tmp/wasp-trace.log wasp db migrate-dev

# Search for schema.prisma in the trace
grep "schema.prisma" /tmp/wasp-trace.log
Filip
Filipβ€’2mo ago
Ok, I'm back Ok, yes, that's what I meant Looks like the last thing we can try is a call Let's schedule one for wednesday I can do: - Anytime between 9 AM and 12 PM CET. - 4 PM - 5 PM CET. Pick any 45 minute slot in those times and I'll send you an invite, I have your email.

Did you find this page helpful?