schickling/chromeless

Fully Deployed On Lambda

CBox opened this issue · 1 comments

CBox commented

Hey,

I've deployed Chromeless on Lambda and it's working great from local machine, I'm using the remote endpoint.

The problem is that I want to host this code as well on Lambda but I'm getting error that async not supported.

async function run() {
    const chromeless = new Chromeless({
      remote: {
        endpointUrl: 'CHROMELESS_ENDPOINT',
        apiKey: 'API_KEY'
      },
    })

    const screenshot = await chromeless
      .goto('https://www.google.com')
      .type('chromeless', 'input[name="q"]')
      .press(13)
      .wait('#resultStats')
      .screenshot()

    console.log(screenshot)

    await chromeless.end()
}

run().catch(console.error.bind(console));

The error from Lambda:

Syntax error in module 'handler': SyntaxError
async function run() {
^^^^^^^^
SyntaxError: Unexpected token function

Just to make clear I've 2 Lambda projects one for Chromeless and the second for the logic with the remote endpoint.

Thanks!

CBox commented

I've just upgraded the nodejs version to nodejs8.10 - fixed :)