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 `node_modules` files are very large

See original GitHub issue

Bug description

Prisma in node_modules is occupying quite a bit of storage on heroku. See:

39M	./node_modules/prisma/node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node
39M	./node_modules/prisma/libquery_engine-debian-openssl-1.1.x.so.node
39M	./node_modules/.prisma/client/libquery_engine-debian-openssl-1.1.x.so.node
36M	./node_modules/@prisma/sdk/dist/libquery_engine-debian-openssl-1.1.x.so.node
36M	./node_modules/@prisma/sdk/dist/get-generators/libquery_engine-debian-openssl-1.1.x.so.node
36M	./node_modules/@prisma/sdk/dist/get-generators/engines/461d6a05159055555eb7dfb337c9fb271cbd4d7e/libquery_engine-debian-openssl-1.1.x.so.node
36M	./node_modules/@prisma/sdk/dist/get-generators/engines/461d6a05159055555eb7dfb337c9fb271cbd4d7e
36M	./node_modules/@prisma/sdk/dist/get-generators/engines
36M	./node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node
35M	./node_modules/prisma/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x
32M	./node_modules/prisma/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x
32M	./node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x
29M	./node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x

How to reproduce

Prisma 4.0

Expected behavior

No response

Prisma information

Prisma 4.0

Environment & setup

  • OS: Heroku Dyno
  • Database: PostgreSQL
  • Node.js version: 16

Prisma Version

prisma                  : 4.0.0
@prisma/client          : 4.0.0
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine da41d2bb3406da22087b849f0e911199ba4fbf11 (at node_modules/prisma/node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli da41d2bb3406da22087b849f0e911199ba4fbf11 (at node_modules/prisma/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core da41d2bb3406da22087b849f0e911199ba4fbf11 (at node_modules/prisma/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt da41d2bb3406da22087b849f0e911199ba4fbf11 (at node_modules/prisma/node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : da41d2bb3406da22087b849f0e911199ba4fbf11
Studio                  : 0.465.0
Preview Features        : interactiveTransactions

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
janpiocommented, Dec 20, 2022

Today’s release 4.8.0 has significantly (average 50%, on some platforms even more) decreased the size of our engine files:

Improved serverless experience — smaller engines size

In this release, we have decreased the size of our engine files by an average of 50%. The size of the Query Engine used on Debian, with OpenSSL 3.0.x, for example, went from 39MB to 14MB. We will also remove some smaller engines to decrease the total size in future versions.

Additionally, we have started optimizing how the Prisma schema is loaded in Prisma Client. You should notice a considerable improvement when executing the first query if you’re working with a bigger schema with many models and relations.

We will continue investing in this direction in the next releases and further improve the experience with Prisma and serverless environments.

https://github.com/prisma/prisma/releases/tag/4.8.0

We know we still have duplicated engine files in multiple locations, and that we are including too many of our engine files - but this was the obvious place to start and we are happy how significantly we could improve the situation already. Expect more updates like this in the coming releases from us.

2reactions
Jolg42commented, Dec 7, 2022

I created and merged a PR about @prisma/internals which included unneeded artifacts. This is usually not an issue for Prisma users, as @prisma/client and prisma CLI packages bundle dependencies and do not include these artifacts. But this is an issue when you have a direct dependency on @prisma/internals (previously @prisma/sdk) in your dependency graph. So either in your package.json or in the package.json of one of your dependencies, for example, prisma-docs-generator has a direct dependency on it and is affected.

@prisma/internals unpacked package went from 124.4 MB to 395.4 kB as a result of the PR (will be in next 4.8.0 release planned for December 20th)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should you use Prisma?
Prisma is a new kind of ORM. This page explains when Prisma would be a good fit, and provides alternatives for other scenarios....
Read more >
Deploying to AWS Lambda - Prisma
In this guide, you will set up and deploy a serverless Node.js REST API to AWS Lambda using the Serverless Framework. AWS Lambda...
Read more >
Prisma CLI Installation (Reference)
The Prisma CLI is typically installed as a development dependency, that's why the --save-dev (npm) and --dev (Yarn) options are used in the...
Read more >
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 >
Seeding your database - Prisma
With TypeScript, ts-node does transpiling and typechecking by default; ... In the seed.ts file, import Prisma Client, initialize it and create some records....
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