aws-amplify / amplify-codegen

Amplify Codegen is a JavaScript toolkit library for frontend and mobile developers building Amplify applications.
Apache License 2.0
59 stars 57 forks source link

Amplify Configure Codegen FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory #842

Closed dan-codes1 closed 1 week ago

dan-codes1 commented 1 month ago

Before opening, please confirm:

How did you install the Amplify CLI?

brew

If applicable, what version of Node.js are you using?

21.7.3

Amplify CLI Version

12.12.0

What operating system are you using?

Mac

Amplify Codegen Command

codegen add, codegen configure

Describe the bug

Hello,

Anytime I run amplify add codegen or amplify configure codegen I get an error: "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory"

This is the error log: danieleze@Daniels-MacBook-Pro-3 xploree-ios % amplify configure codegen ? Enter the file name pattern of graphql queries, mutations and subscriptions gr aphql/*/.graphql ? Do you want to generate/update all possible GraphQL operations - queries, muta tions and subscriptions Yes ? Enter maximum statement depth [increase from default if your schema is deeply nested] 10 ? Enter the file name for the generated code API.swift ? Do you want to generate code for your newly created GraphQL API Yes ✔ Generated GraphQL operations successfully and saved at graphql ⠋ Generating <--- Last few GCs --->

[69303:0x7f81e8040000] 178399 ms: Mark-sweep 4035.0 (4137.7) -> 4022.1 (4140.9) MB, 2154.2 / 0.0 ms (average mu = 0.167, current mu = 0.018) allocation failure; scavenge might not succeed [69303:0x7f81e8040000] 181888 ms: Mark-sweep 4038.2 (4140.9) -> 4025.4 (4144.2) MB, 3445.5 / 0.0 ms (average mu = 0.073, current mu = 0.012) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory 1: 0x10310a505 node::Abort() [/Users/danieleze/.amplify/bin/amplify] 2: 0x10310c414 node::OOMErrorHandler(char const, bool) [/Users/danieleze/.amplify/bin/amplify] 3: 0x1032ee0c0 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, bool) [/Users/danieleze/.amplify/bin/amplify] 4: 0x103535a05 v8::internal::Heap::FatalProcessOutOfMemory(char const) [/Users/danieleze/.amplify/bin/amplify] 5: 0x103533ca1 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/danieleze/.amplify/bin/amplify] 6: 0x1035227cc v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/danieleze/.amplify/bin/amplify] 7: 0x1035236b4 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/danieleze/.amplify/bin/amplify] 8: 0x1034ff6bf v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/danieleze/.amplify/bin/amplify] 9: 0x1039e6c83 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long, v8::internal::Isolate) [/Users/danieleze/.amplify/bin/amplify] 10: 0x102e9ec79 [/Users/danieleze/.amplify/bin/amplify]

Expected behavior

Generate codegen code

Reproduction steps

  1. Add graphql to your amplify project
  2. Dont add codegen on the first prompt
  3. Run amplify push
  4. Then try amplify configure codegen or amplify add codegen

GraphQL schema(s)

```graphql # Put schemas below this line ```

Log output

``` # Put your logs below this line ```

Additional information

No response

phani-srikar commented 1 month ago

Hi @dan-codes1, I suspect if there's anything in your schema definition that's causing the codegen process (types generation) to run out of memory. Please run amplify diagnose --send-report and share the project identifier that gets generated, so we can take try to reproduce with your schema.

AnilMaktala commented 1 week ago

Hey 👋 , This issue is being closed due to inactivity. If you are still experiencing the same problem and need further assistance, please feel free to leave a comment. This will enable us to reopen the issue and provide you with the necessary support.

github-actions[bot] commented 1 week ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.