JavaScript Heap Out of Memory 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:

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

./node_modules/moralis/lib/browser/Web3Connector/Web3AuthConnector.js
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 (moralis-deploy.netlify.app)

2 Likes

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

Sure thing, it is here.