stereobooster/react-snap

UnhandledPromiseRejectionWarning Error: Execution context was destroyed, most likely because of a navigation.

gprasanth24k opened this issue ยท 2 comments

on npm run build

this is the error it is throwing someone please help!

โœ… crawled 11 out of 28 (/aig-cyberedge/)
โœ… crawled 12 out of 28 (/resource/post/march-newsletter-stay-up-to-date-on-cyber-trends-with-bandura-2)
๐Ÿ”ฅ UnhandledPromiseRejectionWarning Error: Execution context was destroyed, most likely because of a navigation.
at rewriteError (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/ExecutionContext.js:167:15)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async ExecutionContext._evaluateInternal (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/ExecutionContext.js:120:56)
at async ExecutionContext.evaluate (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/ExecutionContext.js:48:12)
at async Page. (/Users/admin/Projects/Bandura/bandura-website/node_modules/react-snap/index.js:214:7)
-- ASYNC --
at ExecutionContext. (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/helper.js:111:15)
at DOMWorld.evaluate (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/DOMWorld.js:112:20)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)
-- ASYNC --
at Frame. (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/helper.js:111:15)
at Page.evaluate (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/Page.js:833:43)
at Page. (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/helper.js:112:23)
at Page. (/Users/admin/Projects/Bandura/bandura-website/node_modules/react-snap/index.js:214:18)
at Page.emit (events.js:327:22)
at NetworkManager. (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/Page.js:111:69)
at NetworkManager.emit (events.js:315:20)
at NetworkManager._onResponseReceived (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/NetworkManager.js:272:10)
at CDPSession.emit (events.js:315:20)
at CDPSession._onMessage (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/Connection.js:200:12)
-- ASYNC --
at Page. (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/helper.js:111:15)
at Page. (/Users/admin/Projects/Bandura/bandura-website/node_modules/react-snap/index.js:214:18)
at Page.emit (events.js:327:22)
at NetworkManager. (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/Page.js:111:69)
at NetworkManager.emit (events.js:315:20)
at NetworkManager._onResponseReceived (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/NetworkManager.js:272:10)
at CDPSession.emit (events.js:315:20)
at CDPSession._onMessage (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/Connection.js:200:12)
at Connection._onMessage (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/Connection.js:112:17)
at WebSocket. (/Users/admin/Projects/Bandura/bandura-website/node_modules/puppeteer/lib/WebSocketTransport.js:44:24)
โœ… crawled 13 out of 28 (/resource/post/bandura-threatconnect-proactively-block-threats-using-threat-intelligence)
โœ… crawled 33 out of 35 (/integrations/)
โœ… crawled 34 out of 35 (/about-us/)

We just fixed a similar issue caused by react-snap attempting to crawl redirects we had in react-router.

      <Route
        exact
        path="/<route>"
        component={() => {
          if (navigator.userAgent !== "ReactSnap") {
            window.location.replace('<redirect>');
          }
          return null;
        }}
      />

I can confirm @HWideman solution can solve the issue