lighthouse-lambda
lighthouse-lambda copied to clipboard
Errror: ECONNREFUSED
This is similar to #30, but even with the latest version, getting the following error.
"errorType": "Error",
"errorMessage": "connect ECONNREFUSED 127.0.0.1:41901",
"code": "ECONNREFUSED",
"errno": "ECONNREFUSED",
"syscall": "connect",
"address": "127.0.0.1",
"port": 41901,
"stack": [
"Error: connect ECONNREFUSED 127.0.0.1:41901",
" at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)"
]
Any idea what could be wrong?
lighthouse-lambda: 3.1.1
code is basically the started template from the readme file
I'm getting the same thing with 3.1.1
Same as my error, getting runtime lambda nodejs 10.x and 12.x . but working runtime nodejs8.10
I'm seeing the same issue. Working fine for 8.10
but not 10.x
or 12.x
.
I've made a quick workaround using this lib instead @serverless-chromium: https://github.com/alixaxel/chrome-aws-lambda.
Works with 10.x and 12.x.
npm install chrome-aws-lambda --save-prod
In https://github.com/joytocode/lighthouse-lambda/blob/master/lib/index.js:
const chromium = require('chrome-aws-lambda')
const chromeLauncher = require('chrome-launcher')
const lighthouse = require('lighthouse')
const defaultFlags = [
'--headless',
'--disable-dev-shm-usage',
'--disable-gpu',
'--no-zygote',
'--no-sandbox',
'--single-process',
'--hide-scrollbars'
]
module.exports = async function createLighthouse (url, options = {}, config) {
options.output = options.output || 'html'
const log = options.logLevel ? require('lighthouse-logger') : null
if (log) {
log.setLevel(options.logLevel)
}
const chromeFlags = options.chromeFlags || defaultFlags
return chromeLauncher.launch({ chromeFlags, chromePath: await chromium.executablePath })
.then((chrome) => {
options.port = chrome.port
return {
chrome,
log,
start () {
return lighthouse(url, options, config)
}
}
})
}
@dordax this workaround 'almost' works for me but now I get a bunch of warn Caught exception: NO_TRACING_STARTED
for each type of audit and the final report is just filled with errors instead of the data. My lambda works fine on 8.10 but just wanted to upgrade to keep with the times. Anything you changed in your handler function to go from 8.10 -> 12?
if anyone else runs into this issue trying to use node 12, I did what @dordax did but I needed to remove '--single-process'
to get the performance tests on lighthouse to stop returning errors
Well consider 8.10 is now in maintenance (https://nodejs.org/en/about/releases/) this should probably be updated. I have a fork Im working on, if it works for me I'll open a PR.
@smcelhinney did you get it working? I forked it a few weeks ago and changed a lot of things and got it working on node 12 on the local docker AWS instance but could never get it going on the actual lambda.
I gave up on Lambda and moved my code to Google Cloud Run and Pub Sub topics :)
I finally have a working solution in #37