79757790

Date: 2025-09-06 20:59:36
Score: 6.5 🚩
Natty:
Report link

I'm still having this problem in NextJS that the seeding isn't being executed correctly. When I run npx prisma db seed, no errors are thrown, but the seed isn't being executed.

When I try to start the seed.ts file manually via npx tsx prisma/seed.ts, I get this error:

error: Environment variable not found: DATABASE_URL.  
  --\>  schema.prisma:3  
   |  
 2 |   provider = ā€œpostgresqlā€  
 3 |   url      = env(ā€œDATABASE_URLā€)  
   |  

This is what my prisma.config.ts file looks like

import 'dotenv/config';  
import path from 'node:path';  
import { defineConfig } from 'prisma/config';  
  
export default defineConfig({  
    schema: path.join('prisma', 'schema.prisma'),  
    migrations: {  
        path: path.join('prisma', 'migrations'),  
        seed: 'tsx prisma/seed.ts',  
    },  
});  

It also doesn't matter whether I use tsx prisma/seed.ts or npx tsx prisma/seed.ts as the seed command in the config file, neither works.

Any solutions? Do I need to adjust something else in the seed.ts file?

Reasons:
  • Blacklisted phrase (0.5): I need
  • Blacklisted phrase (1.5): Any solution
  • RegEx Blacklisted phrase (1): I get this error
  • RegEx Blacklisted phrase (2): Any solutions?
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Tobias Westphal