Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

Error: Timed out after 30sec - ECONNREFUSED 127.0.0.1:9222 #425

Open
skylarmb opened this issue Mar 29, 2018 · 2 comments
Open

Error: Timed out after 30sec - ECONNREFUSED 127.0.0.1:9222 #425

skylarmb opened this issue Mar 29, 2018 · 2 comments

Comments

@skylarmb
Copy link

skylarmb commented Mar 29, 2018

Hello, I just deployed the proxy lambda. I am getting two variations of ECONNREFUSED 127.0.0.1:9222

Worth noting this is not a reliability issue (as in 1 of every X requests errors out), I have not been able to get a single successful request.

My code is simply setting the HTML content and then getting a PDF. However, I also tried just fetching a URL and getting a PDF.

await chromeless.setHtml(processedHtml).pdf()

The first request errors out like so:

NOTE: I've cleaned up the logs from Cloudwatch a little bit (removing request IDs and timestamps)

START RequestId: Version: $LATEST
@serverless-chrome/lambda: Spawning headless shell
@serverless-chrome/lambda: ChromeLauncher No debugging port found on port 9222, launching a new Chrome.
@serverless-chrome/lambda: Launcher Chrome running with pid 12 on port 9222.
@serverless-chrome/lambda: Waiting for Chrome 0
@serverless-chrome/lambda: Waiting for Chrome 1
@serverless-chrome/lambda: Started Chrome
@serverless-chrome/lambda: It took 526ms to spawn chrome.
Invoked with data: cjfcv2jwf000001p8ldqmprfu
{
    "debug": false,
    "waitTimeout": 10000,
    "remote": {
        "endpointUrl": "https://XXXXXXXX.execute-api.us-east-1.amazonaws.com/dev",
        "apiKey": "<MY_API_KEY>"
    },
    "implicitWait": true,
    "scrollBeforeClick": false,
    "launchChrome": true,
    "viewport": {
        "scale": 1
    },
    "cdp": {
        "host": "localhost",
        "port": 9222,
        "secure": false,
        "closeTab": true
    }
}

Connected to AWS IoT broker
Subscribed to chrome/cjfcv2jwf000001p8ldqmprfu/request
Message from chrome/cjfcv2jwf000001p8ldqmprfu/request
{
    "type": "setHtml",
    "html": "<!DOCTYPE html>\n<html>\n...</html>\n"
}

Chrome result undefined
Message from chrome/cjfcv2jwf000001p8ldqmprfu/request
{
    "type": "returnPdf"
}

Message from chrome/cjfcv2jwf000001p8ldqmprfu/end
{
    "channelId": "cjfcv2jwf000001p8ldqmprfu",
    "client": true,
    "disconnected": true
}

Client disconnected.
Ended successfully.
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: connect ECONNREFUSED 127.0.0.1:9222
END RequestId: 

Subsequent requests seem to error out like so

START RequestId: Version: $LATEST
@serverless-chrome/lambda: Spawning headless shell
@serverless-chrome/lambda: ChromeLauncher No debugging port found on port 9222, launching a new Chrome.
@serverless-chrome/lambda: Chrome already running with pid 12.
@serverless-chrome/lambda: Waiting for Chrome 0
@serverless-chrome/lambda: Waiting for Chrome 1
@serverless-chrome/lambda: Waiting for Chrome 2
@serverless-chrome/lambda: Waiting for Chrome 3
@serverless-chrome/lambda: Waiting for Chrome 4
@serverless-chrome/lambda: Waiting for Chrome 5
@serverless-chrome/lambda: Waiting for Chrome 6
@serverless-chrome/lambda: Waiting for Chrome 7
@serverless-chrome/lambda: Waiting for Chrome 8
@serverless-chrome/lambda: Waiting for Chrome 9
@serverless-chrome/lambda: Waiting for Chrome 10
@serverless-chrome/lambda: Error trying to spawn chrome: { Error: connect ECONNREFUSED 127.0.0.1:9222
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 9222 }
@asendia
Copy link

asendia commented Apr 11, 2018

I got this error too, I am using lambda in ap-southeast-1 region (also posted in #387)

Here is the detailed lambda log:

START RequestId: c9431f8a-3d4f-11e8-9cb5-07d8577c9903 Version: $LATEST
2018-04-11T06:15:52.383Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Spawning headless shell
2018-04-11T06:15:52.383Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda ChromeLauncher No debugging port found on port 9222, launching a new Chrome.
2018-04-11T06:15:52.393Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Chrome already running with pid 12.
2018-04-11T06:15:52.393Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Waiting for Chrome 0
2018-04-11T06:15:52.895Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Waiting for Chrome 1
2018-04-11T06:15:53.397Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Waiting for Chrome 2
2018-04-11T06:15:53.898Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Waiting for Chrome 3
2018-04-11T06:15:54.400Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Waiting for Chrome 4
2018-04-11T06:15:54.901Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Waiting for Chrome 5
2018-04-11T06:15:55.402Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Waiting for Chrome 6
2018-04-11T06:15:55.904Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Waiting for Chrome 7
2018-04-11T06:15:56.405Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Waiting for Chrome 8
2018-04-11T06:15:56.907Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Waiting for Chrome 9
2018-04-11T06:15:57.408Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Waiting for Chrome 10
2018-04-11T06:15:57.409Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda Error trying to spawn chrome: { Error: connect ECONNREFUSED 127.0.0.1:9222
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 9222 }
2018-04-11T06:15:57.413Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda stdout log: 
2018-04-11T06:15:57.413Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	@serverless-chrome/lambda stderr log: [0411/060612.401837:WARNING:resource_bundle.cc(353)] locale_file_path.empty() for locale 
[0411/060612.501432:VERBOSE1:webrtc_internals.cc(106)] Could not get the download directory.
[0411/060612.501498:VERBOSE1:proxy_service.cc(965)] PAC support disabled because there is no system implementation
[0411/060612.825828:WARNING:histograms.cc(40)] Started multiple compositor clients (Browser, Renderer) in one process. Some metrics will be disabled.
[0411/060613.120938:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Aviator' log
[0411/060613.120972:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Icarus' log
[0411/060613.120982:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Pilot' log
[0411/060613.120990:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Rocketeer' log
[0411/060613.121000:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Skydiver' log
[0411/060613.121008:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: DigiCert Log Server
[0411/060613.121016:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Symantec log
[0411/060613.121024:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Symantec 'Vega' log
[0411/060613.121032:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: WoSign log
[0411/060613.121039:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: CNNIC CT log
[0411/060613.121047:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: StartCom log
[0411/060613.121055:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: PuChuangSiDa CT log
[0411/060613.121063:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Izenpe log
[0411/060613.121071:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Venafi log
[0411/060613.121079:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Certly.IO log
[0411/060713.465046:WARNING:sandbox_ipc_linux.cc(88)] poll: Operation not permitted
[0411/061112.376102:WARNING:sandbox_ipc_linux.cc(88)] poll: Operation not permitted
[0411/061326.822968:WARNING:sandbox_ipc_linux.cc(88)] poll: Operation not permitted
[0411/061403.384428:WARNING:sandbox_ipc_linux.cc(88)] poll: Operation not permitted
[0411/061403.384480:FATAL:sandbox_ipc_linux.cc(90)] poll(2) failing. SandboxIPCHandler aborting.
#0 0x00000140d027 base::debug::StackTrace::StackTrace()
#1 0x00000141de0d logging::LogMessage::~LogMessage()
#2 0x0000009de9e6 content::SandboxIPCHandler::Run()
#3 0x000001458ec5 base::SimpleThread::ThreadMain()
#4 0x0000014552d3 base::(anonymous namespace)::ThreadFunc()
#5 0x7f28fe308de5 start_thread
#6 0x7f28fc32c30d __clone

Received signal 6
#0 0x00000140d027 base::debug::StackTrace::StackTrace()
#1 0x00000140cb9f base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7f28fe3105a0 <unknown>
#3 0x7f28fc2691f7 __GI_raise
#4 0x7f28fc26a8e8 __GI_abort
#5 0x00000140bce2 base::debug::BreakDebugger()
#6 0x00000141e160 logging::LogMessage::~LogMessage()
#7 0x0000009de9e6 content::SandboxIPCHandler::Run()
#8 0x000001458ec5 base::SimpleThread::ThreadMain()
#9 0x0000014552d3 base::(anonymous namespace)::ThreadFunc()
#10 0x7f28fe308de5 start_thread
#11 0x7f28fc32c30d __clone
r8: 00007f28f5900a0b r9: 00007f28fc384fb0 r10: 0000000000000008 r11: 0000000000000206
r12: 00007f28fcb44980 r13: 00007f28f5900cd0 r14: 0000000000000060 r15: 00007f28f5900cc8
di: 000000000000000c si: 000000000000000d bp: 0000000003d511f5 bx: 00007f28f5900870
dx: 0000000000000006 ax: 0000000000000000 cx: 00007f28fc2691f7 sp: 00007f28f59006d8
ip: 00007f28fc2691f7 efl: 0000000000000206 cgf: 002b000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.

2018-04-11T06:15:57.413Z	c9431f8a-3d4f-11e8-9cb5-07d8577c9903	Error occured in serverless-plugin-chrome wrapper when trying to ensure Chrome for default() handler.
{}
Error: Unable to start Chrome. If you have the DEBUG env variable set,there will be more in the logs.
at /var/task/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:304:13
at throw (native)
at step (/var/task/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:257:191)
at /var/task/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:257:402
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
END RequestId: c9431f8a-3d4f-11e8-9cb5-07d8577c9903
REPORT RequestId: c9431f8a-3d4f-11e8-9cb5-07d8577c9903	Duration: 5031.59 ms	Billed Duration: 5100 ms Memory Size: 1536 MB	Max Memory Used: 181 MB

@calvinkei
Copy link

calvinkei commented May 31, 2018

got this error just now. i have been using the same set up for months but it doesn't work just now

UPDATE: just redeploy the chromeless proxy and everything works like magic lol

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants