Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgresql-supabase instructions missing db seed step #5721

Open
kiptoomm opened this issue Feb 27, 2024 · 0 comments
Open

postgresql-supabase instructions missing db seed step #5721

kiptoomm opened this issue Feb 27, 2024 · 0 comments

Comments

@kiptoomm
Copy link

In this repo https://github.com/prisma/prisma-examples/tree/latest/databases/postgresql-supabase, the following error occurs when running the last step (npm run dev) in the README instructions:

No 'User' record(s) (needed to inline the relation on 'Post' record(s)) was found for a nested connect on one-to-many relation 'PostToUser'.

The README should be updated to include the database seeding step prior to running the script e.g:

npx prisma db seed

Full output
$ npm run dev
> [email protected] dev
> ts-node script.ts

Retrieved all published posts:  []
PrismaClientKnownRequestError:
Invalid `prisma.post.create()` invocation in
~/postgresql-supabase/script.ts:13:37

  10 console.log('Retrieved all published posts: ', allPosts)
  11
  12 // Create a new post (written by an already existing user with email [email protected])
→ 13 const newPost = await prisma.post.create(
An operation failed because it depends on one or more records that were required but not found. No 'User' record(s) (needed to inline the relation on 'Post' record(s)) was found for a nested connect on one-to-many relation 'PostToUser'.
    at _n.handleRequestError (~/postgresql-supabase/node_modules/@prisma/client/runtime/library.js:123:6854)
    at _n.handleAndLogRequestError (~/postgresql-supabase/node_modules/@prisma/client/runtime/library.js:123:6188)
    at _n.request (~/postgresql-supabase/node_modules/@prisma/client/runtime/library.js:123:5896)
    at async l (~/postgresql-supabase/node_modules/@prisma/client/runtime/library.js:128:10871) {
  code: 'P2025',
  clientVersion: '5.10.2',
  meta: {
    modelName: 'Post',
    cause: "No 'User' record(s) (needed to inline the relation on 'Post' record(s)) was found for a nested connect on one-to-many relation 'PostToUser'."
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant