Search code examples
javascriptreactjstypescriptnext.jsvercel

RangeError: Maximum call stack size exceeded Next.js


I am trying to deploy my project to vercel.com and i got this error with 3 pages don't have any errors inside

Error occurred prerendering page "/applications". Read more: https://nextjs.org/docs/messages/prerender-error
RangeError: Maximum call stack size exceeded
    at P (/vercel/path0/.next/server/chunks/686.js:10:66480)
    at l (/vercel/path0/.next/server/chunks/686.js:10:61660)
    at /vercel/path0/.next/server/chunks/686.js:10:62861
    at Array.forEach (<anonymous>)
    at /vercel/path0/.next/server/chunks/686.js:10:62834
    at Array.forEach (<anonymous>)
    at a (/vercel/path0/.next/server/chunks/686.js:10:62654)
    at /vercel/path0/.next/server/chunks/686.js:10:62918
    at Array.forEach (<anonymous>)
    at l (/vercel/path0/.next/server/chunks/686.js:10:62611)
RangeError: Maximum call stack size exceeded
    at P (/vercel/path0/.next/server/chunks/686.js:10:66480)
    at l (/vercel/path0/.next/server/chunks/686.js:10:61660)
    at /vercel/path0/.next/server/chunks/686.js:10:62861
    at Array.forEach (<anonymous>)
    at /vercel/path0/.next/server/chunks/686.js:10:62834
    at Array.forEach (<anonymous>)
    at a (/vercel/path0/.next/server/chunks/686.js:10:62654)
    at /vercel/path0/.next/server/chunks/686.js:10:62918
    at Array.forEach (<anonymous>)
    at l (/vercel/path0/.next/server/chunks/686.js:10:62611)

i just need help to fix this

the pages contains 2 components

<DashboardHeader />
<ComponentName /> // Depends on page

every component of the three pages has a array.map in the page to show data from array to page


Solution

  • 
              {jobs.map(job => (
                <JobCard
                  key={job.id}
                  job={job}
                  isSelected={job.id === selectedJobId}
                  onSelect={handleSelectJob}
                />
              ))}
    
    

    Removing the above code removed the issue, so that's where it comes from. I don't know why the map is problematic on vercel with static data.