stereobooster / react-snap

👻 Zero-configuration framework-agnostic static prerendering for SPAs
MIT License
5.04k stars 391 forks source link

UnhandledPromiseRejectionWarning Error: Execution context was destroyed, most likely because of a navigation. at rewriteError (\node_modules\react-snap\node_modules\puppeteer\lib\ExecutionContext.js:167:15) #498

Open hirenatwiley opened 3 years ago

hirenatwiley commented 3 years ago

Bug Report

Current Behavior Having react snap following version "react-snap": "^1.23.0"

Added following configuration for build "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "postbuild": "react-snap" }, "reactSnap": { "include": [ "/site-crawl-page/" ], "inlineCss": true, "preconnectThirdParty": true, "preloadImages": true, "asyncScriptTags": true, "puppeteer": { "timeout": 0 }, "puppeteerArgs": [ "--no-sandbox", "--disable-setuid-sandbox" ] }

Now when i perform npm run build getting following error ✅ crawled 593 out of 618 (/blog/cfa/page/7/) 🔥 UnhandledPromiseRejectionWarning Error: Execution context was destroyed, most likely because of a navigation. at rewriteError (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\ExecutionContext.js:167:15) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5) at async ExecutionContext._evaluateInternal (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\ExecutionContext.js:120:56) at async ExecutionContext.evaluate (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\ExecutionContext.js:48:12) at async Page. (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\index.js:174:11) -- ASYNC -- at ExecutionContext. (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\helper.js:111:15) at DOMWorld.evaluate (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\DOMWorld.js:112:20) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5) -- ASYNC -- at Frame. (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\helper.js:111:15) at Page.evaluate (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\Page.js:833:43) at Page. (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\helper.js:112:23) at Page. (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\index.js:174:22) at Page.emit (events.js:327:22) at NetworkManager. (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\Page.js:111:69) at NetworkManager.emit (events.js:315:20) at NetworkManager._onResponseReceived (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\NetworkManager.js:272:10) at CDPSession.emit (events.js:315:20) at CDPSession._onMessage (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\Connection.js:200:12) -- ASYNC -- at Page. (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\helper.js:111:15) at Page. (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\index.js:174:22) at Page.emit (events.js:327:22) at NetworkManager. (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\Page.js:111:69) at NetworkManager.emit (events.js:315:20) at NetworkManager._onResponseReceived (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\NetworkManager.js:272:10) at CDPSession.emit (events.js:315:20) at CDPSession._onMessage (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\Connection.js:200:12) at Connection._onMessage (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\Connection.js:112:17) at WebSocket. (c:\jenkins\workspace\WEL_UAT_Jobs\WEL_Static_Build_React_Snap\node_modules\react-snap\node_modules\puppeteer\lib\WebSocketTransport.js:44:24) ⚠� warning: inlining CSS more than 20kb (30.01171875kb, critical) ✅ crawled 594 out of 618 (/cfa/why-wiley/makes-us-better/)

pipaliyachirag commented 3 years ago

same issue any solution?

woskaangel commented 3 years ago

I've run into the same problem. Did you find a solution?

pipaliyachirag commented 3 years ago

Nope still looking for solution 😂

gprasanth24k commented 3 years ago

Same issue, any solution!?

woskaangel commented 3 years ago

@gprasanth24k You can write an endpoint to convert in the "package.json" file.

gprasanth24k commented 3 years ago

you mean proxy?

I added proxy in package.json file

"proxy":"https://xxzzyy.com/" this way

but same error plz help me in this

woskaangel commented 3 years ago

This is my Snap Setting. "reactSnap": { "include": [ "/", ], "inlineCss": true, "puppeteer": { "cache": false }, "puppeteerArgs": [ "--no-sandbox", "--disable-setuid-sandbox" ] }

If there is no problem setting, check if 45678 port is occupied elsewhere! If the 45678 port is occupied elsewhere, try rebooting your laptop or changing the port at 'node_modules/react-snap/index.js' 17line.