question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Hi,

I try to prerender a relative big amount of page in webpack, ~800 pages. Webpack never end and throw me next error: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

As recomend, I use @prerenderer/renderer-jsdom

Here my plugin config, I don’t understand why it take so many memory In my test I limit the 800 pages to first 200 and 1494Mb seem not be enough

const PrerenderSpaPlugin = require('prerender-spa-plugin')
const JSDOMRenderer = require('@prerenderer/renderer-jsdom')

            new PrerenderSpaPlugin({
              renderer: new JSDOMRenderer({
                  maxConcurrentRoutes: 50,
                  renderAfterDocumentEvent: 'app-rendered',
                  renderAfterTime: 4000
              }),
              staticDir: path.join(__dirname, '../build'),
              outputDir: path.join(__dirname, '../build'),
              routes: urlsToPrerender,
              // renderAfterDocumentEvent: 'app-rendered',
              postProcess (renderedRoute) {
                  const $ = cheerio.load(renderedRoute.html)

                  $('head').children().each(function() {
                      var Src = this.attribs.src

                      if(Src !== undefined) {

                          if(Src.indexOf('maps.googleapis.com') !== -1) {
                              $(this).remove();
                          }
                      }
                  });

                    renderedRoute.html = $.html()

                    return renderedRoute
                },
            })

Thanks for your help

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
JoshTheDerfcommented, Apr 26, 2018

Wow. Have you tried using PuppeteerRenderer and something like maxConcurrentRoutes: 10?

0reactions
JoshTheDerfcommented, Apr 27, 2018

@Kleinast Interesting. Good luck!

Read more comments on GitHub >

github_iconTop Results From Across the Web

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed ...
Your code works fine for me with Node.js 0.10.28. It took 1200 MB of virtual memory and printed an unbelievable amount of junk...
Read more >
JavaScript heap out of memory - Snyk Support
FATAL ERROR : CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of ... You can increase the amount of memory allocated to the command...
Read more >
How to resolve - FATAL ERROR: CALL_AND_RETRY_LAST ...
FATAL ERROR : CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory How to get rid of this issue?Is it related to physical ......
Read more >
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed
I'm trying to deploy my app but I'm getting this error: 7:13:48 PM: Creating an ... Allocation failed - JavaScript heap out of...
Read more >
How to Fix JavaScript Heap Out of Memory Error - MakeUseOf
This error usually occurs when the default memory allocated by your system to Node. js is not enough to run a large project....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found