chrome aws lambda

Solutions on MaxInterview for chrome aws lambda by the best coders in the world

showing results for - "chrome aws lambda"
Rémy
21 Jul 2019
1const chromium = require('chrome-aws-lambda'); exports.handler = async (event, context, callback) => {  let result = null;  let browser = null;   try {    browser = await chromium.puppeteer.launch({      args: chromium.args,      defaultViewport: chromium.defaultViewport,      executablePathawait chromium.executablePath,      headless: chromium.headless,      ignoreHTTPSErrorstrue,    });     let page = await browser.newPage();     await page.goto(event.url || 'https://example.com');     result = await page.title();  } catch (error) {    return callback(error);  } finally {    if (browser !== null) {      await browser.close();    }  }   return callback(null, result);};