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.

`Error: spawn /var/task/headless-chromium ENOENT` when using webpack

See original GitHub issue

I’m using serverless-plugin-chrome and I recently switched to using webpack.

plugins:
  - serverless-plugin-chrome
  - serverless-webpack

However when I try to invoke local I get the following error:

@serverless-chrome/lambda Spawning headless shell
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
@serverless-chrome/lambda Error trying to spawn chrome: TypeError: Cannot read property 'toString' of undefined
    at Launcher.<anonymous> (/Users/dholdren/projects/test_serverless_chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:170:63)
    at next (native)
    at /Users/dholdren/projects/test_serverless_chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:12:71
    at __awaiter (/Users/dholdren/projects/test_serverless_chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:8:12)
    at spawnPromise (/Users/dholdren/projects/test_serverless_chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:155:41)
    at Launcher.<anonymous> (/Users/dholdren/projects/test_serverless_chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:173:16)
    at next (native)
    at /Users/dholdren/projects/test_serverless_chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:12:71
    at __awaiter (/Users/dholdren/projects/test_serverless_chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:8:12)
    at Launcher.spawnProcess (/Users/dholdren/projects/test_serverless_chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:153:16)
    at Launcher.<anonymous> (/Users/dholdren/projects/test_serverless_chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:148:35)
    at throw (native)
    at rejected (/Users/dholdren/projects/test_serverless_chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:10:65)
    at process._tickDomainCallback (internal/process/next_tick.js:135:7)
@serverless-chrome/lambda stdout log:
@serverless-chrome/lambda stderr log:
Error occured in serverless-plugin-chrome wrapper when trying to ensure Chrome for handler() handler. { flags: [], chromePath: '/var/task/headless-chromium' } Error: Unable to start Chrome. If you have the DEBUG env variable set,there will be more in the logs.
    at /Users/dholdren/projects/test_serverless_chrome/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:317:13
    at throw (native)
    at step (/Users/dholdren/projects/test_serverless_chrome/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:258:191)
    at /Users/dholdren/projects/test_serverless_chrome/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:258:402
    at process._tickDomainCallback (internal/process/next_tick.js:135:7)
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn /var/task/headless-chromium ENOENT
    at exports._errnoException (util.js:1018:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)

I found this line which seems to be the cause of the problem, but I’m not sure what the original intent of it was: chromePath: this.webpack ? '/var/task/headless-chromium' : undefined, https://github.com/adieuadieu/serverless-chrome/blob/master/packages/serverless-plugin/src/index.js#L138

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

1reaction
dholdrencommented, Jan 18, 2018

ok after updating the serverless-webpack plugin to 4.2.0, I no longer get this error on AWS. The earlier version I had was missing a hook that serverless-chrome-plugin depended on.

However I do still get it locally. I’ve opened a PR to fix this problem: https://github.com/adieuadieu/serverless-chrome/pull/104

1reaction
dholdrencommented, Jan 18, 2018

I’m getting this on AWS also, so I’m amending the title.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`Error: spawn /var/task/headless-chromium ENOENT` when ...
Error : spawn /var/task/headless-chromium ENOENT` when using ... I'm using serverless-plugin-chrome and I recently switched to using webpack.
Read more >
Module build failed: Error: spawn bin/rails ENOENT
Try changing the runner option in config\webpack\loaders\erb.js to runner: "ruby bin\\rails runner" . – Arctodus. Feb 16, 2018 at 13:15.
Read more >
Error: spawn node_modules/webpack/bin/webpack.js ENOENT
Hi I am in windows 10 when I issue the command npm run dev. it shows error. Error: spawn node_modules/webpack/bin/webpack.js ENOENT.
Read more >
Sample app won't start (Error: ENOENT on "npm start") - Web
Description Hi guys, I downloaded the Fully customizable web .zip file and tried running the sample app from the “Sample&Libs” directory.
Read more >
Uncaught exception: Error: spawn ENOENT - Google Groups
Hi- I am running a shiny-server as a non-root user on RedHat using the built from git master branch. While I am able...
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