Serverless-chrome: Readme out of date, error: launchChrome is not a function

Created on 20 Dec 2017  Â·  2Comments  Â·  Source: adieuadieu/serverless-chrome

Trying to run the following code:

const launchChrome = require('@serverless-chrome/lambda');
export const hello = (event, context, callback) => {
  launchChrome({}).then(chrome => {
    console.log(chrome);
    callback(null, {
      status: 'it worked'
    })
  }).catch(callback);
};

via serverless invoke local -f first I receive the error: launchChrome is not a function. Is the readme out of date with the API?

question

All 2 comments

Hi @zachschultz — Hm.. What do you get when you console.log(launchChrome) ? Does the following work?

const launchChrome = require('@serverless-chrome/lambda').default;

export const hello = (event, context, callback) => {
  launchChrome().then(chrome => {
    console.log(chrome);
    callback(null, {
      status: 'it worked'
    })
  }).catch(callback);
};

@adieuadieu Following code works.

Was this page helpful?
0 / 5 - 0 ratings