From 257b0c731b9e0460de17bd6b661e285316cc652e Mon Sep 17 00:00:00 2001 From: Julian Poyourow Date: Tue, 5 Feb 2019 15:40:39 -0800 Subject: [PATCH 1/3] Puppeteer init before sending success response --- Backend/routes/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Backend/routes/index.js b/Backend/routes/index.js index 4ee621d82..70d0b4f1f 100644 --- a/Backend/routes/index.js +++ b/Backend/routes/index.js @@ -80,6 +80,8 @@ router.get( } ] }).then(async (user) => { + const browser = await puppeteer.launch({ headless: false }); + Raven.captureMessage('Starting import job', { level: 'info' }); @@ -88,8 +90,6 @@ router.get( msg: "Starting scrape..." }); - const browser = await puppeteer.launch({ headless: false }); - try { var username = req.query.username; var password = req.query.password; From 0448bea4c8155a6aea0ca753a22a0996ce028539 Mon Sep 17 00:00:00 2001 From: Julian Poyourow Date: Tue, 5 Feb 2019 15:40:52 -0800 Subject: [PATCH 2/3] Update reqs --- reqs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reqs.sh b/reqs.sh index 6972e688e..0073a071d 100755 --- a/reqs.sh +++ b/reqs.sh @@ -1,7 +1,7 @@ #!/bin/bash # NightmareJS Scraper Engine Reqs -sudo apt install xvfb libasound2 libgconf-2-4 libgtk2.0-0 libxss1 ttf-freefont -y +sudo apt install libnss3 libasound2 libxss1 -y sudo npm install -g electron --unsafe-perm=true --allow-root From 321cb5b41f16eb2de5b3b609c038e65559fccc5c Mon Sep 17 00:00:00 2001 From: Julian Poyourow Date: Tue, 5 Feb 2019 15:44:19 -0800 Subject: [PATCH 3/3] Launch puppeteer headless --- Backend/routes/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Backend/routes/index.js b/Backend/routes/index.js index 70d0b4f1f..ff8d7db94 100644 --- a/Backend/routes/index.js +++ b/Backend/routes/index.js @@ -80,7 +80,9 @@ router.get( } ] }).then(async (user) => { - const browser = await puppeteer.launch({ headless: false }); + const browser = await puppeteer.launch({ + headless: (process.env.NODE_ENV || 'dev') !== 'dev' + }); Raven.captureMessage('Starting import job', { level: 'info'