question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error attempting to `yarn prisma db seed`

See original GitHub issue

Hi @AlphaNecron , I’m encountering an error when attempting this (docker-compose). Any ideas?

/void # export DATABASE_URL=postgres://postgres:<password>@postgres/postgres
/void # yarn prisma db seed
yarn run v1.22.15
$ /void/node_modules/.bin/prisma db seed
Running seed command `ts-node --compiler-options {"module":"commonjs"} prisma/seed.ts` ...
PrismaClientKnownRequestError: 
Invalid `prisma.user.aggregate()` invocation:

  The table `public.User` does not exist in the current database.
    at cb (/void/node_modules/@prisma/client/runtime/index.js:38537:17)
    at async main (/void/prisma/seed.ts:8:17) {
  code: 'P2021',
  clientVersion: '3.3.0',
  meta: { table: 'public.User' }
}

An error occured while running the seed command:
Error: Command failed with exit code 1: ts-node --compiler-options {"module":"commonjs"} prisma/seed.ts

I’ve also tried npx... with the same result.

To further elaborate: postgres container is running. I see the following errors in the container:

2022-02-15 15:14:17.132 UTC [1019] ERROR:  relation "public.User" does not exist at character 56
2022-02-15 15:19:43.828 UTC [1297] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."User"."id" FROM "public"."User" WHERE 1=1 OFFSET $1) AS "sub"
2022-02-15 15:14:17.132 UTC [1019] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."User"."id" FROM "public"."User" WHERE 1=1 OFFSET $1) AS "sub"
2022-02-15 15:19:43.828 UTC [1297] ERROR:  relation "public.User" does not exist at character 56

Thank you,

_Originally posted by @tmeuze in https://github.com/AlphaNecron/Void/issues/16#issuecomment-1040408758_

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
AlphaNecroncommented, Feb 22, 2022

No need, normally it does automatically for you.

1reaction
AlphaNecroncommented, Feb 15, 2022
  • Stop all related containers
  • Do docker rmi postgres -f
  • Rebuild using Docker compose However, you can consider changing from v0 to dev branch. (By editing docker-compose.yml)
Read more comments on GitHub >

github_iconTop Results From Across the Web

prisma db seed doesn't correctly support "type": "module" #7053
Problem. When you enable module resolution with "type": "module" on your projet the prisma db seed command fail due to ts-node resolution.
Read more >
prisma db seed & typescript problem with import and type ...
Try and double-check your seed command in the prisma section of your package.json, it should look like the one in the repo of...
Read more >
Seeding your database - Prisma
This guide describes how to seed your database using Prisma Client and Prisma's integrated seeding functionality. Seeding allows you to consistently ...
Read more >
How to seed a database with Prisma and Next.js - PlanetScale
Go ahead and add a try/catch/finally block inside of your function to handle errors and disconnect from your database after the seeding has ......
Read more >
Running npx prisma db seed after deployment - How To - Fly.io
Running seed command node --require esbuild-register prisma/seed.ts … node:internal/modules/cjs/loader:936 throw err; ^. Error: Cannot find ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found