Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: has anyone used chrome-aws-lambda with chrome-remote-interface instead of puppeteer? #86

Closed
renschler opened this issue Dec 18, 2019 · 3 comments
Labels
question Further information is requested

Comments

@renschler
Copy link

renschler commented Dec 18, 2019

I'm trying to port my project from serverless-chrome to chrome-aws-lambda because serverless-chrome no longer works with node 10 + Amazon Linux 2 (see issue: adieuadieu/serverless-chrome#203).

Anyways, my project uses chrome-remote-interface and not puppeteer and it would be awesome I didn't have to port things to puppeteer and I could just reuse my chrome-remote-interface code.

Has anyone done this? I'm sure it's doable but just not sure how I should go about it.

@extraordinaire
Copy link

@renschler see about running locally, otherwise chromium.executablePath will return null and there's no .then on null :)

Something like this should work:

const Chrome = require('chrome-remote-interface')
const chromium = require('chrome-aws-lambda')
const { spawn } = require('child_process')

const options = chromium.args.concat(['--remote-debugging-port=9222'])

chromium.executablePath.then(path => {
  chrome = spawn(path, options)
  chrome.stdout.on('data', data => console.log(data.toString()))
  chrome.stderr.on('data', data => console.log(data.toString()))

  Chrome().then(client => {
    const {Emulation, Network, Page, Runtime, DOM, Console} = client
  })
})

@renschler
Copy link
Author

thank you! I'll try it out

@alixaxel alixaxel added the question Further information is requested label Jan 3, 2020
@alixaxel
Copy link
Owner

alixaxel commented Jan 3, 2020

Yes, exactly @extraordinaire that should do it - thanks for stepping in! 😃 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants