Skip to content

Commit b4a76f7

Browse files
committed
test: chrome aws lambda
1 parent cb22d94 commit b4a76f7

File tree

3 files changed

+174
-3
lines changed

3 files changed

+174
-3
lines changed

app.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,14 @@ app.get('/history/charts/:country', async (req, res, next) => {
222222
}
223223

224224

225-
226-
const puppeteer = require('puppeteer');
227-
const browser = await puppeteer.launch();
225+
const chrome = require('chrome-aws-lambda');
226+
const puppeteer = require('puppeteer-core');
227+
const browser = await puppeteer.launch({
228+
args: chrome.args,
229+
executablePath: await chrome.executablePath,
230+
headless: chrome.headless,
231+
});
232+
228233
const page = await browser.newPage();
229234
page.setViewport({width: 1440, height: 800})
230235
await page.goto(req.protocol + '://' + req.get('host') +'/history/charts/web/'+s.country);

package-lock.json

Lines changed: 164 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@
3535
"blessed": "^0.1.11",
3636
"blessed-contrib": "^2.3.1",
3737
"bufferutil": "^4.0.1",
38+
"chrome-aws-lambda": "^2.1.1",
3839
"clear": "^0.1.0",
3940
"cli-table3": "^0.5.1",
4041
"express": "^4.17.1",
4142
"figlet": "^1.3.0",
4243
"ora": "^4.0.3",
4344
"puppeteer": "^2.1.1",
45+
"puppeteer-core": "^2.1.1",
4446
"utf-8-validate": "^5.0.2",
4547
"ws": "^7.2.3",
4648
"yargs": "^15.3.1"

0 commit comments

Comments
 (0)