Seeding not working in prisma.config.ts
Our CLIs have been screaming at us for a while, to upgrade from the package.json "prisma: {}" property, to the
prisma.config.ts file. With this message:
Currently we have both in our codebase, here's our package.json entry:
This works fine. I can run pnpx prisma db seed and it executes this seeding.
However, if I move the seeding to the prisma.config.ts, it no longer works. It simply just says "Environment variables loaded from .env" and then immediately exits, as if it found no script.
I should note we are in a monorepo, and this prisma: { ... } block is in the root package.json, but the prisma.config.ts file is located close to prisma, in the packages/db folder.
I would like to be able to run the pnpx prisma db seed script from root, and have it run the correct seed script, same as I am able to today.
I have also tried various variations of the path in the seed script, to ensure I was pointing to the correct folder. Even if I just print a simple logging script like pnpm why prisma it isn't running.
Is there any reason this couldn't work from the config, when it works from the prisma property in package.json?
I should note it does work if I first navigate to the db package, and run the prisma db seed script from there, but I'd really avoid having to that, if at all possible.5 Replies
You decided to hold for human wisdom. We'll chime in soon! Meanwhile,
#ask-ai is there if you need a quick second opinion.Would it be possible to provide a minimal reproduction so that we can investigate?
Yes. I'll also verify if this is still an issue with 6.18.0 first 👍
Seems that some love was paid to the config file, which may have inadvertently helped solve this. I'll report back
https://github.com/aarhusgregersen/prisma-seed-minimal-reproduction
Here is a minimal reproduction, as the issue is still not fixed.
It does not matter which commands I enter in the
seed script, they are not coming through.
I could run pnpm exec ls on the command line, but running that very same command from the seed script, provides no output in the console, except the following (see image)GitHub
GitHub - aarhusgregersen/prisma-seed-minimal-reproduction: Minimal ...
Minimal reproduction of prisma seed issue in monorepo - aarhusgregersen/prisma-seed-minimal-reproduction
@Nurul any news on this?
Verifying for myself in our reproduction repo, and then in primary application, this seems to have been resolved as of 7.0.0! Thank you 🙏