Add AWS Lambda compatibility

main
Elbert Alias 5 years ago
parent 8809ab6641
commit dc7ffd175e

@ -1,4 +1,21 @@
const puppeteer = require('puppeteer'); const {
AWS_LAMBDA_FUNCTION_NAME,
CHROME_BIN,
} = process.env;
let chromium;
let puppeteer;
if (AWS_LAMBDA_FUNCTION_NAME) {
// eslint-disable-next-line global-require, import/no-unresolved
chromium = require('chrome-aws-lambda');
({ puppeteer } = chromium);
} else {
// eslint-disable-next-line global-require
puppeteer = require('puppeteer');
}
const Browser = require('../browser'); const Browser = require('../browser');
function getJs() { function getJs() {
@ -39,9 +56,14 @@ class PuppeteerBrowser extends Browser {
super(options); super(options);
this.browser = () => puppeteer.launch({ this.browser = async () => puppeteer.launch(chromium ? {
executablePath: process.env.CHROME_BIN, args: [...chromium.args, '--ignore-certificate-errors'],
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath,
headless: chromium.headless,
} : {
args: ['--no-sandbox', '--headless', '--disable-gpu', '--ignore-certificate-errors'], args: ['--no-sandbox', '--headless', '--disable-gpu', '--ignore-certificate-errors'],
executablePath: CHROME_BIN,
}); });
} }

@ -2,7 +2,7 @@
"name": "wappalyzer", "name": "wappalyzer",
"description": "Uncovers the technologies used on websites", "description": "Uncovers the technologies used on websites",
"homepage": "https://github.com/AliasIO/Wappalyzer", "homepage": "https://github.com/AliasIO/Wappalyzer",
"version": "5.9.10", "version": "5.9.12",
"author": "Elbert Alias", "author": "Elbert Alias",
"license": "GPL-3.0", "license": "GPL-3.0",
"repository": { "repository": {

Loading…
Cancel
Save