chrisvfritz / prerender-spa-plugin

Prerenders static HTML in a single-page application.
MIT License
7.31k stars 633 forks source link

Print failing route for: [prerender-spa-plugin] Unable to prerender all routes! #358

Open jamiecarter7 opened 4 years ago

jamiecarter7 commented 4 years ago

Is there a way to return the failing route where the prerender fails to improve bug hunting.

I have a site that renders upwards of 500 pages.

My CI unreliably completes and fails with this error for unknown reasons, it was getting to the point where I just had to keep running the build process until it randomly passed.

Having this feature would be really handy as it would help identify the failing route during the build.

pixelatorz commented 4 years ago

it might have something to do with the amount of pages. I Received the same error, I thought there where errors on my page.

however when i split up the routes into different smaller renders, it seems to work... I think it got something to do with puppeteer taking a lot of resources.

jamiecarter7 commented 4 years ago

So do you launch puppeteer several times in each build? I assume this then saves the files to disk rather than filling up the RAM.

Can you elaborate with code on how do did the above or what your current setup is. I'm intrigued

pixelatorz commented 4 years ago

seems addingmaxConcurrentRoutes: 4 did the trick for me, I guess the system couldn't handle more. this is how i did the current setup, loading my pages from contentful https://pastebin.com/YT2SWsup

jamiecarter7 commented 4 years ago

The original reason for this request is that my prerender would fail and pass without any code changes. I was sometimes having to run the build process 3 times before the prerender would complete.

Every time it would fail with the above error code.

Having a single printed route where the fail occured would be very handy to have rather than having to continually try to look through a list of 500 URLs for potential rogue one. Also waiting 10-15 minutes for the build to fail gets tiresome.

Also dont you think a failed prerender because of too many concurrent max routes should have a different fail message?

pixelatorz commented 4 years ago

true, error messages could definitely improve

hermanbanken commented 3 years ago

Error is swallowed here: https://github.com/chrisvfritz/prerender-spa-plugin/blob/0af6806d009fc2e47414c1b8c0600bf32800ab51/es6/index.js#L143-L149

I fixed that locally by logging the actual error (err) & process.exit(1) (otherwise the terminal buffer is flushed and the error disappears).