JavaScript Heap Out of Memory issue

I just updated the moralis sdk version to the newest one.
And now I have this type of error.

<--- Last few GCs --->

[10957:0xddaa40]    58599 ms: Mark-sweep 1334.8 (1404.9) -> 1334.7 (1404.4) MB, 508.0 / 0.0 ms  (average mu = 0.219, current mu = 0.000) last resort GC in old space requested
[10957:0xddaa40]    59203 ms: Mark-sweep 1334.7 (1404.4) -> 1334.7 (1404.4) MB, 604.7 / 0.0 ms  (average mu = 0.110, current mu = 0.000) last resort GC in old space requested

<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x272a6745452b]
Security context: 0x01e1c8b2ee11 <JSObject>
    1: set [0x1e1c8b44629](this=0x1af6e86a3029 <Map map = 0x306198f92691>,0x1ccc891fcc91 <Uint8Array map = 0x306198fe7e01>,496213)
    2: addReferenceable(aka addReferenceable) [0x1af6e86a3049] [/home/nft-enthusiast/projects/frontend/node_modules/webpack/lib/serialization/ObjectMiddleware.js:~259] [pc=0x272a68d7cfd9](this=0x285e056825d9 <undefined>,item=0x1c...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 0x7f3474c8d46c node::Abort() [/lib/x86_64-linux-gnu/]
 2: 0x7f3474c8d4b5  [/lib/x86_64-linux-gnu/]
 3: 0x7f3474eb9e6a v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/]
 4: 0x7f3474eba0e1 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/]
 5: 0x7f3475254c66  [/lib/x86_64-linux-gnu/]
 6: 0x7f3475268a37 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/lib/x86_64-linux-gnu/]
 7: 0x7f3475234bfb v8::internal::Factory::AllocateRawArray(int, v8::internal::PretenureFlag) [/lib/x86_64-linux-gnu/]
 8: 0x7f3475235098 v8::internal::Factory::NewFixedArrayWithFiller(v8::internal::Heap::RootListIndex, int, v8::internal::Object*, v8::internal::PretenureFlag) [/lib/x86_64-linux-gnu/]
 9: 0x7f3475235144 v8::internal::Handle<v8::internal::FixedArray> v8::internal::Factory::NewFixedArrayWithMap<v8::internal::FixedArray>(v8::internal::Heap::RootListIndex, int, v8::internal::PretenureFlag) [/lib/x86_64-linux-gnu/]
10: 0x7f34753bddbb v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Allocate(v8::internal::Isolate*, int, v8::internal::PretenureFlag) [/lib/x86_64-linux-gnu/]
11: 0x7f34753c0e23 v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Rehash(v8::internal::Handle<v8::internal::OrderedHashMap>, int) [/lib/x86_64-linux-gnu/]
12: 0x7f347548e0ae v8::internal::Runtime_MapGrow(int, v8::internal::Object**, v8::internal::Isolate*) [/lib/x86_64-linux-gnu/]
13: 0x272a6745452b 
Aborted (core dumped)
error Command failed with exit code 134.
info Visit for documentation about this command.
error Command failed with exit code 134.
info Visit for documentation about this command.

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

I know setting memery limit for node would solve the issue but still couldn’t get it working after allocating 8 GB.

I see some people having the same issue coz of some packages compatibility.
Has anyone had similar issue before?
Is there any solution I could fix this issue?

what did you do to get that error?

Just tried to run the project.
Whatever I tried, like yarn dev or yarn build, ended up getting this error.

with what version of the sdk you have this problem?
can you revert to a version where it works?

Yes. I used to Moralis 0.0.184 and some functions didn’t work there.
I updated them to the latest moralis version and now it’s not working. :frowning:
The only libraries I added are magic-sdk, @web3auth/web3auth, react-moralis, and web3.

there are a lot of changes with the latest version of the sdk compared to version 0.0.148, but it shouldn’t generate that error

Hi cryptokid, I have been experiencing this same error when using the Moralis SDK. Locally, the project builds fine. Deployed to Netlify, it fails by running out of memory. Could you provide the packages, versions of the packages and dependencies needed to run the react-moralis package?

We have:
@walletconnect/web3-provider”: “^1.7.8”,
@web3auth/web3auth”: “^1.0.0”,
“moralis”: “^1.7.0”,
“react-moralis”: “^1.3.5”,

Do you know what is the memory limit set on netlify?

When does it generate that error? You have to do something?

A few months ago, I had issue with the core sdk, without using walletconnect or web3auth and was able to get past it by modifying my build script to the following:

“build:app”: “react-scripts --max_old_space_size=4096 build”,

Giving the max_old_space_size the value of 4096. I believe this is the maximum allowable for the system. Is more needed?

The error is generated during the build process.

Can you try without these dependencies in case that you don’t use them?

This means a limit of 4GB?

Removing them before worked by it seems that they are dependencies of moralis:

Module not found: Can’t resolve ‘@walletconnect/web3-provider’ in ‘…/node_modules/moralis/lib/browser/Web3Connector’

Module not found: Can’t resolve ‘@web3auth/web3auth’ in ‘…/node_modules/moralis/lib/browser/Web3Connector’

those are errors that stops the build?

The build exceeds available space… I get the following error:

2:21:38 PM: The build failed because the process exited too early. This probably means the system ran out of memory or someone called kill -9 on the process.

I have isolated it to the moralis packages some months ago but will try again, shortly, without moralis, and see if it is successful again. I will get back to you after running that test.

Installing one of either web3auth or walletconnect breaks deploying to Netlify with the latest Moralis and react-moralis versions.

You can just do a base project with Moralis and react-moralis, it will deploy and the app should still function normally even with these errors.

This has been tried. Indeed it does fail on deployment but Netlify doesn’t ignore that. It ignores it locally on development but deployed, fails the build completely…

8:13:22 PM: ./node_modules/moralis/lib/browser/Web3Connector/WalletConnectWeb3Connector.js
8:13:22 PM: Module not found: Can’t resolve ‘@walletconnect/web3-provider’ in ‘/opt/build/repo/node_modules/moralis/lib/browser/Web3Connector’
8:13:22 PM: ./node_modules/moralis/lib/browser/Web3Connector/Web3AuthConnector.js
8:13:22 PM: Module not found: Can’t resolve ‘@web3auth/web3auth’ in ‘/opt/build/repo/node_modules/moralis/lib/browser/Web3Connector’

I was able to deploy a fresh CRA/moralis/react-moralis to Netlify. Did you try with a new project?

With a working application, I only added the main provider to the application. Made no calls or included any components and the deployment fails. Is there a repo deployed? I was going to request to see this from the devs here. I believe this is a bug

May be an issue with your current project. This is it deployed just using MoralisProvider. React App (


That’s awesome glad… can I clone this and perhaps build off of it? I would need the repo link