Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS 13 JavaScript heap out of memory using SliceZone #190

Open
amendezm opened this issue Jul 5, 2023 · 2 comments
Open

NextJS 13 JavaScript heap out of memory using SliceZone #190

amendezm opened this issue Jul 5, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@amendezm
Copy link

amendezm commented Jul 5, 2023

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

I started a little project using nextjs 13 and prismic, I´m getting this error every time I navigate to pages using the <SliceZone/> component. Only have 3 slices created, all marked as client components.

Versions

  • @prismicio/react: v2.7.1
  • react: v18.2.0
  • node: v18.12.0

Local Environment

  • windows 10 22h2
  • 8gb ram

Below is my package.json

{
  "name": "nextjs",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "slicemachine": "start-slicemachine"
  },
  "dependencies": {
    "@headlessui/react": "^1.7.15",
    "@prismicio/client": "7.1.0",
    "@prismicio/next": "1.3.2",
    "@prismicio/react": "2.7.1",
    "classnames": "2.3.2",
    "eslint": "8.42.0",
    "eslint-config-next": "13.4.6",
    "framer-motion": "^10.12.18",
    "next": "13.4.8",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-icons": "4.10.1"
  },
  "devDependencies": {
    "@slicemachine/adapter-next": "^0.3.1",
    "@types/node": "20.3.1",
    "@types/react": "18.2.14",
    "autoprefixer": "10.4.14",
    "eslint": "8.33.0",
    "eslint-config-next": "13.1.6",
    "eslint-config-prettier": "8.6.0",
    "eslint-plugin-prettier": "4.2.1",
    "eslint-plugin-react": "7.32.2",
    "eslint-plugin-react-hooks": "4.6.0",
    "postcss": "8.4.24",
    "slice-machine-ui": "^1.4.0",
    "tailwindcss": "3.3.2"
  }
}

image

image

I would really appreciate your help

@amendezm amendezm added the bug Something isn't working label Jul 5, 2023
@s-hirvonen
Copy link

Approximately how many items do you have in those slice zones in your Prismic repository?

@angeloashmore
Copy link
Member

@amendezm <SliceZone> is primarily a wrapper around slices.map(), so it is unlikely to be the cause of a "out of memory" error. The components, however, could contribute to memory usage.

Could you try the following?

  • Comment out all properties in the components object in slices/index.js.
  • Uncomment each Slice one by one and determine if a specific Slice component is causing the memory problem.
  • If you are able to narrow down which component causes the error, is there anything special about that Slice? Does it have any unique logic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants