question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Cannot find module 'puppeteer-core/lib/Browser'

See original GitHub issue

Trying to execute README example, the following error occurred.

Environment

  • chrome-aws-lambda Version: 3.1.1
  • puppeteer / puppeteer-core Version: 5.1.0
  • OS: Linux
  • Node.js Version: 12.x
  • Lambda / GCF Runtime: nodejs12.x

Expected Behavior

Should have returned example.com content.

Current Behavior

Following error occurs:

Lambda execution failed with status 200 due to customer function error:  Cannot find module 'puppeteer-core/lib/Browser'
Require stack:
- /var/task/node_modules/chrome-aws-lambda/source/puppeteer/lib/Browser.js
- /var/task/node_modules/chrome-aws-lambda/source/index.js
- /var/task/app.js

No Browser module expored in the following path: ‘puppeteer-core/lib/Browser’

Steps to Reproduce

Lambda functions: memory is 1024M, timeout is 3000ms.

const 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,
      executablePath: await chromium.executablePath,
      headless: chromium.headless,
      ignoreHTTPSErrors: true,
    });

    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);
};

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:18
  • Comments:16

github_iconTop GitHub Comments

8reactions
Nigrimmistcommented, Jun 28, 2022

13.7.0 works fine for me

5reactions
danteaycommented, Jul 15, 2020

Also downgrading to versions 3.0.4 of chrome-aws-lambda and puppeteer-core works for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'puppeteer-core/internal/common/Device.js'
I was able to fix it with: npm i puppeteer@18.1.0. Then adding chrome.exe from Windows to my $PATH. And changing the test to...
Read more >
Troubleshooting - Puppeteer
The most common cause is a bug in Node.js v14.0.0 which broke extract-zip , the module Puppeteer uses to extract browser downloads into...
Read more >
Puppeteer - npm
Puppeteer is a Node.js library which provides a high-level API to control Chrome/Chromium over the DevTools Protocol.
Read more >
Browser Automation - Laracasts
I got this error in the browser. { "errorType": "Error", "errorMessage": "Cannot find module '/var/task/node_modules/puppeteer-core/ ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
If you're a developer that works with Node JS and JavaScript libraries and frameworks like React, Vue, and Angular, then you might have ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found