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] MODULE_NOT_FOUND in puppeteer-core - wrong path.

See original GitHub issue

Environment

  • chrome-aws-lambda Version: 5.2.0
  • puppeteer-core Version: 5.2.1
  • Lambda Runtime: nodejs12.x

Expected Behavior

Returns: Example Domain.

So it should not fail with MODULE_NOT_FOUND.

Current Behavior

Invoke Error 	
{
    "errorType": "Error",
    "errorMessage": "Cannot find module 'puppeteer-core/lib/cjs/common/Browser'\nRequire stack:\n- /var/task/node_modules/chrome-aws-lambda/source/puppeteer/lib/Browser.js\n- /var/task/node_modules/chrome-aws-lambda/source/index.js\n- /var/task/handler.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
    "code": "MODULE_NOT_FOUND",
    "requireStack": [
        "/var/task/node_modules/chrome-aws-lambda/source/puppeteer/lib/Browser.js",
        "/var/task/node_modules/chrome-aws-lambda/source/index.js",
        "/var/task/handler.js",
        "/var/runtime/UserFunction.js",
        "/var/runtime/index.js"
    ],
    "stack": [
        "Error: Cannot find module 'puppeteer-core/lib/cjs/common/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/handler.js",
        "- /var/runtime/UserFunction.js",
        "- /var/runtime/index.js",
        "    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:842:27)",
        "    at Module.require (internal/modules/cjs/loader.js:1026:19)",
        "    at require (internal/modules/cjs/helpers.js:72:18)",
        "    at Object.<anonymous> (/var/task/node_modules/chrome-aws-lambda/source/puppeteer/lib/Browser.js:6:11)",
        "    at Module._compile (internal/modules/cjs/loader.js:1138:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)",
        "    at Module.load (internal/modules/cjs/loader.js:986:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:879:14)",
        "    at Module.require (internal/modules/cjs/loader.js:1026:19)"
    ]
}

Steps to Reproduce

Possible Solution

Correct the modules paths to match the current ones. This is puppeteer-core/lib/cjs/puppeteer/common/Browser etc. Done in PR #157 !

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
omri08commented, Oct 9, 2020

Hello 😃 I’m using: “chrome-aws-lambda”: “^5.2.1”, “puppeteer-core”: “^5.2.1”, And still got the same error, which version should I use? The error I’m getting: Error: Cannot find module ‘/var/task/src/handlers/puppeteer/lib/Browser’

6reactions
alixaxelcommented, Aug 12, 2020

Just released v5.2.1 - sorry about the blunder! 😳

Read more comments on GitHub >

github_iconTop Results From Across the Web

puppeteer-core - npm
A high-level API to control headless Chrome over the DevTools Protocol. Latest version: 19.4.1, last published: 10 days ago.
Read more >
How to fix issue "Error: Cannot find module 'puppeteer'" when ...
1 Answer 1 · I get an error: "Failed to launch the browser process" and that it cannot find the chrome.exe file on...
Read more >
Getting to Know Puppeteer Using Practical Examples
Let's examine a few cases. Launching Chromium. The easiest way to interact with the browser is by launching a Chromium instance using Puppeteer: ......
Read more >
Trying Lambda Functions with Puppeteer and getting Browser ...
Hey, I wasn't sure if this is related to Netlify or Puppeteer, but does someone know what's causing the following error: Browser is...
Read more >
Troubleshooting - Puppeteer
If you get an error that looks like this when trying to launch Chromium: (node:15505) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser ...
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