1

We are working on Sitecore 10.3 with Next.js on Docker. In one of our components, we are trying to get the data from Sitecore. We added a graphql query by creating a file called NavigationIntegrated.graphql. Here is the query we added

# Write your query or mutation here
query NavigationIntegrated($datasource: String!, $language: String!) {
  fields: item(path: $datasource, language: $language) {
    ... on Navigation_341097f16ec54c218b19c7414d0c9061 {
      logo {
        jsonValue
      }
      searchLink {
        jsonValue
      }
      freeQuoteButtonLink{
        jsonValue
      }
      utilityNav{
        jsonValue
      }
        logoLink
      {
        jsonValue
      }
      children{
        results{
          fields{
            jsonValue
          }
          children{
            results{
              fields{
                jsonValue
              }
              children{
                results{
                  fields{
                    jsonValue
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

The issue is, when we do npm run build we get the below error.

[ graphql-let ] Processing 1 codegen...

<--- Last few GCs --->

[232:00000194EA90A5B0]  1230830 ms: Scavenge 8189.8 (8198.8) -> 8188.2 (8199.3) MB, 3.6 / 0.0 ms  (average mu = 0.354, current mu = 0.350) allocation failure;


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF65675D51F node_api_throw_syntax_error+175743
 2: 00007FF6566E2E66 v8::internal::wasm::WasmCode::safepoint_table_offset+59654
 3: 00007FF6566E4B72 v8::internal::wasm::WasmCode::safepoint_table_offset+67090
 4: 00007FF65718AAB4 v8::Isolate::ReportExternalAllocationLimitReached+116
 5: 00007FF657175E12 v8::Isolate::Exit+674
 6: 00007FF656FF7C6C v8::internal::EmbedderStackStateScope::ExplicitScopeForTesting+124
 7: 00007FF657004F4D v8::internal::Heap::PublishPendingAllocations+1117
 8: 00007FF657001FD7 v8::internal::Heap::PageFlagsAreConsistent+3367
 9: 00007FF656FF4707 v8::internal::Heap::CollectGarbage+2039
10: 00007FF65700B0C3 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath+2099
11: 00007FF65700B96D v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath+93
12: 00007FF6570142BA v8::internal::Factory::AllocateRaw+810
13: 00007FF6570276FD v8::internal::FactoryBase<v8::internal::Factory>::NewHeapNumber<0>+685
14: 00007FF65702BBA8 v8::internal::FactoryBase<v8::internal::Factory>::NewRawTwoByteString+72
15: 00007FF656DD34F4 v8::internal::String::SlowFlatten+724
16: 00007FF656CFEA84 v8::internal::DeclarationScope::was_lazily_parsed+35092
17: 00007FF657228051 v8::internal::SetupIsolateDelegate::SetupHeap+558193
18: 00007FF657218B94 v8::internal::SetupIsolateDelegate::SetupHeap+495540
19: 00007FF5D7543F18
ERROR: "bootstrap" exited with 134.

Our integration is the same as given in the thread but it is not solving the issue.

'jss bootstrap' causes JavaScript heap out of memory error on graphql-let step

One main thing to notice here, in the graphql query we are trying to get the four levels of child items. So if you see the query, when we add only two levels of children, then npm run build works perfectly. But when we add more than two (as you can see in the query we are trying to get three levels of children) then it gives the error.

We have also added a couple of more solutions but they didn't work.

Any help would be appreciated.

1
  • If its running on docker could you try increasing the allocated memory to the container? Commented Sep 19, 2023 at 6:21

1 Answer 1

0

I was able to get rid of the memory heap issue by encapsulating children results into the template type every where I'm getting children items and removing fragments from my graphQL query.

ChildItems: children (includeTemplateIDs: ["Template item id"])  { 
results{
          ... on TestTemplate{
                  id
                  name
                  title{value}
                  subtitle{value}
            }
}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.