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.

Prisma broken for next when generating prisma client in non-node_modules dirs

See original GitHub issue

My bad 😦

Broke by my PR here: https://github.com/t3-oss/create-t3-turbo/pull/37

Error here, unable to find schema: https://twitter.com/t3dotgg/status/1582936894991609857 image

Tried solution here: https://github.com/prisma/prisma/issues/10433#issuecomment-1264687986

Gets further, but new error:

@acme/nextjs:dev: prisma:query SELECT `main`.`Post`.`id`, `main`.`Post`.`title`, `main`.`Post`.`content` FROM `main`.`Post` WHERE 1=1 LIMIT ? OFFSET ?
@acme/nextjs:dev: prisma:query SELECT 1
@acme/nextjs:dev: prisma:query SELECT name FROM sqlite_schema
@acme/nextjs:dev:       WHERE type='table'
@acme/nextjs:dev:       ORDER BY name;
@acme/nextjs:dev:       
@acme/nextjs:dev: failed to fetch, PrismaClientKnownRequestError: 
@acme/nextjs:dev: Invalid `prisma.post.findMany()` invocation:
@acme/nextjs:dev: 
@acme/nextjs:dev: 
@acme/nextjs:dev: The table `main.Post` does not exist in the current database.
@acme/nextjs:dev:     at RequestHandler.handleRequestError (webpack-internal:///(api)/../../packages/db/.generated/client/runtime/index.js:31874:19)
@acme/nextjs:dev:     at RequestHandler.request (webpack-internal:///(api)/../../packages/db/.generated/client/runtime/index.js:31853:18)
@acme/nextjs:dev:     at async PrismaClient._request (webpack-internal:///(api)/../../packages/db/.generated/client/runtime/index.js:32853:24)
@acme/nextjs:dev:     at async eval (webpack-internal:///(api)/../../packages/api/src/router/post.ts:19:26)
@acme/nextjs:dev:     at async resolveMiddleware (file:///Users/theobrowne/Code/contrib/npm-turbo-t3/node_modules/@trpc/server/dist/router-28a2c129.mjs:190:30)
@acme/nextjs:dev:     at async callRecursive (file:///Users/theobrowne/Code/contrib/npm-turbo-t3/node_modules/@trpc/server/dist/router-28a2c129.mjs:226:32)
@acme/nextjs:dev:     at async resolve (file:///Users/theobrowne/Code/contrib/npm-turbo-t3/node_modules/@trpc/server/dist/router-28a2c129.mjs:254:24)
@acme/nextjs:dev:     at async file:///Users/theobrowne/Code/contrib/npm-turbo-t3/node_modules/@trpc/server/dist/resolveHTTPResponse-f2b378b6.mjs:374:32
@acme/nextjs:dev:     at async Promise.all (index 0)
@acme/nextjs:dev:     at async resolveHTTPResponse (file:///Users/theobrowne/Code/contrib/npm-turbo-t3/node_modules/@trpc/server/dist/resolveHTTPResponse-f2b378b6.mjs:371:28) {
@acme/nextjs:dev:   code: 'P2021',
@acme/nextjs:dev:   clientVersion: '4.5.0',
@acme/nextjs:dev:   meta: { table: 'main.Post' }
@acme/nextjs:dev: }

assumption is that it can’t actually find the db in next, which is weird because it can totally find it in prisma studio? idk.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:24 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
nickyhajalcommented, Nov 4, 2022

Using the changes from @subaanqasim got things running for me (very appreciated) locally.

When I run the deploy, I see this:

@padelstripes/db:db-generate: > @padelstripes/db@0.1.0 db-generate /vercel/path0/packages/db
@padelstripes/db:db-generate: > prisma generate
@padelstripes/db:db-generate: 
@padelstripes/db:db-generate: Prisma schema loaded from prisma/schema.prisma
@padelstripes/db:db-generate: 
@padelstripes/db:db-generate: ✔ Generated Prisma Client (4.5.0 | library) to ./../../node_modules/.prisma/client in 255ms
@padelstripes/db:db-generate: You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
@padelstripes/db:db-generate: ```
@padelstripes/db:db-generate: import { PrismaClient } from '../../node_modules/.prisma/client'

However, the API calls return:

ERROR	Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues

Seems like either the db package is looking in the wrong place, or the generation output is going maybe two levels up from the root and out of the project?

Anyone hit on anything like this?

2reactions
JesseKoldewijncommented, Oct 24, 2022

oh yeah lol, I got a ENOENT no such file error on the trpc API file pointing towards the prisma schema.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma CLI installation hangs indefinitely inside of docker ...
So to confirm there is no log, and it hangs at prisma generate executed during postinstall? (Tested with @prisma/cli 2.15.0?) A workaround /...
Read more >
NestJS Prisma client unable to import generated types
However the issue now is that I have an error prompting that FulfilmentReportCreateInput is not an exported member when I can see it's...
Read more >
Production database is not building - RedwoodJS Community
Hello people, I'm working on my deployment on netlify, so far I had to fix a couple of issues ( prod vars &...
Read more >
Building Dad Jokes using The Prisma Framework (formerly ...
The newest version of Prisma does not require any such thing. ... const joke4 = await photon.jokes.create({ data: { joke: "Dad died because ......
Read more >
please make sure your database server is running at ...
The command '/bin/sh -c npx prisma db push' returned a non-zero code: 1 ... file with all config. the main resan why postgres...
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