prisma: Error `prisma generate` on huge schema (100+ tables)
Bug description
Prisma throwing error on very large schema:
RangeError: Invalid string length
at PassThrough.stream.getBufferedValue (/Users/r/Documents/wms-pos/node_modules/prisma/build/index.js:2913:25)
at rejectPromise (/Users/r/Documents/wms-pos/node_modules/prisma/build/index.js:2953:40)
at PassThrough.<anonymous> (/Users/r/Documents/wms-pos/node_modules/prisma/build/index.js:2967:11)
at PassThrough.emit (node:events:406:35)
at PassThrough.emit (node:domain:470:12)
at addChunk (node:internal/streams/readable:312:12)
at readableAddChunk (node:internal/streams/readable:283:11)
at PassThrough.Readable.push (node:internal/streams/readable:226:10)
at node:internal/streams/transform:192:12
at PassThrough._transform (node:internal/streams/passthrough:46:3)
How to reproduce
- Create blank prisma project
- Use provided prisma schema
- See the error
Expected behavior
npx prisma generate run succesfully
Prisma information
Environment & setup
- OS: macOS
- Database: PostgreSQL
- Node.js version: v.16.5.0
Prisma Version
prisma : 2.28.0
@prisma/client : 2.28.0
Current platform : darwin-arm64
Query Engine : query-engine 89facabd0366f63911d089156a7a70125bfbcd27 (at ../../node_modules/prisma/node_modules/@prisma/engines/query-engine-darwin-arm64)
Migration Engine : migration-engine-cli 89facabd0366f63911d089156a7a70125bfbcd27 (at ../../node_modules/prisma/node_modules/@prisma/engines/migration-engine-darwin-arm64)
Introspection Engine : introspection-core 89facabd0366f63911d089156a7a70125bfbcd27 (at ../../node_modules/prisma/node_modules/@prisma/engines/introspection-engine-darwin-arm64)
Format Binary : prisma-fmt 89facabd0366f63911d089156a7a70125bfbcd27 (at ../../node_modules/prisma/node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
Default Engines Hash : 89facabd0366f63911d089156a7a70125bfbcd27
Studio : 0.417.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 15 (11 by maintainers)
@janpio update, I just re-run newly installed prisma with the same schema… now it returns shorter error:
I think I’m also hitting this issue. @janpio I am emailing over our schema now and will link this comment in the email
Here are the errors I’m seeing
Another very interesting thing happens if you switch back to the
binaryengine file:I could reproduce on
5.1.0, the error changed a bit now.Note: I had to fix some schema validations, so here is the updated schema file: schema.prisma.zip
Can confirm this is reproducible for me as well and you are hitting this issue (and not #12221 which looks similar but is different). We will hopefully be able to look into this soon, thanks to both your reproductions now @tnrich and @rizkyramadhan.
Running the
binaryCLI manually to get the dmmf for the schema provided above (with theurladded) actually works:This creates a 1.34 GB Json string with 44.763.742 lines.
Running this a few more times gives other, interesting errors like this one:
I can see the Query Engine process taking full CPU cores and quickly eating up memory (up to 2.6GB) before it crashes.