nodejs chrome serverless ENOENT error testing locally

Viewed 194

I am trying to invoke my serverless function locally after installing puppeteer using the following instructions. Using the following command serverless invoke local -f myfunction I get this error:

Serverless: Injecting Headless Chrome...

  Error --------------------------------------------------

  ENOENT: no such file or directory, unlink '/home/user/Desktop/scrape/.build/handler.js'

I'm not sure why i get this error as the file does exist

the handler file it is pointing to looks like this:

const launch = require('@serverless-chrome/lambda')

const handler = require('./l5eo0hsbprn___handler.js')
const options = {"flags":[]}

module.exports.myfunction = function ensureHeadlessChrome (
  event,
  context,
  callback
) {
  return (typeof launch === 'function' ? launch : launch.default)(options)
    .then(instance =>
      handler.myfunction(event, context, callback, instance))
    .catch((error) => {
      console.error(
        'Error occured in serverless-plugin-chrome wrapper when trying to ' +
          'ensure Chrome for myfunction() handler.',
        options,
        error
      )

      callback(error)
    })
}
0 Answers
Related