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.

Inline/bundle the contents of the prisma schema on generate

See original GitHub issue

We could close a whole class of issues where the schema is not found (https://github.com/prisma/prisma/labels/topic%3A ENOENT schema.prisma) by inlining the contents of the schema.prisma directly into the generated index.js. Our logic happens to break usually when code is bundled (nextjs, svelte, webpack).

When code is bundled to another location, our lookup paths for the schema do not make sense any longer. We have logic to at best find the original generated folder, which works at best but has not guarantee it could find the correct folder and fails especially on monorepos.

A solution to this is to directly embed the prisma schema, which needs to be passed to the engines. Side note: We might experience the same thing again for sqlite databases since we resolve their normal location relatively to the generated client.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:33
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
millspcommented, May 13, 2022

Hey everyone, I have a testing version to share. If you have some time, could you please give a try?

  • npm i prisma@3.15.0-integration-fix-inline-schema.5 and
  • npm i @prisma/client@3.15.0-integration-fix-inline-schema.5

Looking for your feedback 😃

2reactions
orbitelevencommented, May 10, 2022

I’m thinking/hoping this would finally allow us to move our repo over from Yarn v3 to pnpm. As it is, Prisma does not seem to behave well in a pnpm monorepo. I’d love to help, but TBH not sure I have the time to dive in on the Prisma codebase ATM. Happy to help test things, though. Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma schema (Reference)
The Prisma schema is the main configuration file when using Prisma. It is typically called schema.prisma and contains your database connection and data ......
Read more >
Prisma schema API (Reference)
API reference documentation for the Prisma Schema Language (PSL). ... One way to do so is by creating a .env file with the...
Read more >
Generators (Reference) - Prisma
A generator determines which assets are created when you run the prisma generate command. The main property provider defines which Prisma Client (language ......
Read more >
Schema prototyping with db push - Prisma
Use db push to push the initial schema to the database: $npx prisma db push. Create some example content: const add = await...
Read more >
Prisma CLI Command Reference
Create migrations from your Prisma schema, apply them to the database, generate artifacts (e.g. ... The content will be sent as the script...
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