MichalLytek / typegraphql-prisma

Prisma generator to emit TypeGraphQL types and CRUD resolvers from your Prisma schema
https://prisma.typegraphql.com
MIT License
887 stars 113 forks source link

JavaScript heap out of memory #443

Open maradney opened 7 months ago

maradney commented 7 months ago

Describe the Bug I've had this issue on multiple servers with different providers where I can't generate on server due to memory issue. I've solved this before by copying generated files from node_modules on my machine to the repo and pushing it. but this is not a solution.

To Reproduce Get a vps server and try to deploy. Mine is this from hostinger. also had similar results with AWS.

Screenshot 2024-03-03 at 7 31 14 PM

Expected Behavior To run prisma-generate without issues.

Logs

Generator "typegraphql-prisma" failed:

<--- Last few GCs --->
[2732:0x7111870]    96935 ms: Mark-sweep (reduce) 2036.3 (2083.2) -> 2035.5 (2083.4) MB, 1798.3 / 0.0 ms  (average mu = 0.143, current mu = 0.013) allocation failure; scavenge might not succeed
[2732:0x7111870]    98775 ms: Mark-sweep (reduce) 2036.5 (2083.4) -> 2035.7 (2083.7) MB, 1806.6 / 0.0 ms  (average mu = 0.083, current mu = 0.018) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb87bc0 node::Abort() [node]
 2: 0xa96834  [node]
 3: 0xd687f0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xd68b97 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xf462a5  [node]
 6: 0xf471a8 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
 7: 0xf576b3  [node]
 8: 0xf58528 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 9: 0xf32e8e v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0xf34257 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
11: 0xf1542a v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
12: 0x12da78f v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
13: 0x170a079  [node]
Aborted (core dumped)

Environment (please complete the following information):

MichalLytek commented 7 months ago

Please generate the code as a source code, so then you can bundle it and ship ready to use js code, without generating it on server.