Created
November 25, 2022 14:39
-
-
Save jsanta/4adbcdb00409c81853c8b9241fe36ccc to your computer and use it in GitHub Desktop.
Hot patch for Scully puppeteer plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/@scullyio/scully-plugin-puppeteer/src/lib/plugins-scully-plugin-puppeteer.js b/node_modules/@scullyio/scully-plugin-puppeteer/src/lib/plugins-scully-plugin-puppeteer.js | |
index a9beeba..57b0ba7 100644 | |
--- a/node_modules/@scullyio/scully-plugin-puppeteer/src/lib/plugins-scully-plugin-puppeteer.js | |
+++ b/node_modules/@scullyio/scully-plugin-puppeteer/src/lib/plugins-scully-plugin-puppeteer.js | |
@@ -23,7 +23,7 @@ catch (e) { | |
// version = jsonc.parse(readFileSync(join(__dirname, '../../../package.json')).toString()).version || '0.0.0'; | |
} | |
const puppeteerRender = (route) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | |
- const timeOutValueInSeconds = 25; | |
+ const timeOutValueInSeconds = scully_1.scullyConfig.renderTimeout ?? 25; | |
const pageLoaded = new rxjs_1.Subject(); | |
const path = route.rawRoute | |
? route.rawRoute | |
@@ -110,7 +110,8 @@ const puppeteerRender = (route) => tslib_1.__awaiter(void 0, void 0, void 0, fun | |
}); | |
}); | |
// enter url in page | |
- yield page.goto(path); | |
+ const pageTimeout = (scully_1.scullyConfig.puppeteerLaunchOptions || { timeout: 0 }).timeout; | |
+ yield page.goto(path, { waitUntil: 'domcontentloaded', timeout: pageTimeout }); | |
pageLoaded.next(); | |
yield Promise.race([pageReady, scully_1.waitForIt(timeOutValueInSeconds * 1000)]); | |
/** when done, add in some scully content. */ | |
@@ -180,7 +181,9 @@ const puppeteerRender = (route) => tslib_1.__awaiter(void 0, void 0, void 0, fun | |
scully_1.logError(`Puppeteer error while rendering "${scully_1.yellow(route.route)}"`, err, ' we retried rendering this page 3 times.'); | |
/** we tried this page before, something is really off. Exit stage left. */ | |
captureMessage_1.captureException(err); | |
- process.exit(15); | |
+ // Commented the process.exit cause it finishes everything | |
+ // don't need to exit, already skipped the file | |
+ // process.exit(15); | |
} | |
else { | |
const count = errorredPages.get(route.route) || 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Before running Scully (or after installing dependencies) run
npx patch-package