Serverless-chrome: Unable to start Chrome in NodeJS10.x

Created on 16 May 2019  路  19Comments  路  Source: adieuadieu/serverless-chrome

I an running into the error "Unable to start Chrome" when running on Lambda with NodeJS10. Seems the system fails to due to this error: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory.

With the update to NodeJS10, Amazon included an update to "Amazon Linux 2", which is likely the cause of this issue.

AWS Lambda NodeJS10 article: https://aws.amazon.com/about-aws/whats-new/2019/05/aws_lambda_adds_support_for_node_js_v10/

In case it helps, here are my full logs:

Wed, 15 May 2019 21:42:12 GMT i18n:warn Failed to install `intl` polyfill
START RequestId: 8813c5b1-1c60-4c06-94f6-8e64f983bfe0 Version: $LATEST
2019-05-15T21:42:13.155Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Spawning headless shell
2019-05-15T21:42:13.174Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: ChromeLauncher No debugging port found on port 9222, launching a new Chrome.
2019-05-15T21:42:13.192Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Launcher Chrome running with pid 19 on port 9222.
2019-05-15T21:42:13.192Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Waiting for Chrome 0
2019-05-15T21:42:13.694Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Waiting for Chrome 1
2019-05-15T21:42:14.196Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Waiting for Chrome 2
2019-05-15T21:42:14.697Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Waiting for Chrome 3
2019-05-15T21:42:15.199Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Waiting for Chrome 4
2019-05-15T21:42:15.700Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Waiting for Chrome 5
2019-05-15T21:42:16.201Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Waiting for Chrome 6
2019-05-15T21:42:16.703Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Waiting for Chrome 7
2019-05-15T21:42:17.204Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Waiting for Chrome 8
2019-05-15T21:42:17.706Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Waiting for Chrome 9
2019-05-15T21:42:18.207Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Waiting for Chrome 10
2019-05-15T21:42:18.208Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: Error trying to spawn chrome: { Error: connect ECONNREFUSED 127.0.0.1:9222 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 9222 }
2019-05-15T21:42:18.208Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: stdout log:
2019-05-15T21:42:18.209Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    INFO    @serverless-chrome/lambda: stderr log: /var/task/node_modules/@serverless-chrome/lambda/dist/headless-chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
2019-05-15T21:42:18.209Z    8813c5b1-1c60-4c06-94f6-8e64f983bfe0    ERROR   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:376:13
at Generator.throw (<anonymous>)
at step (/var/task/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:311:193)
at /var/task/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:311:404
at propagateAslWrapper (/var/task/node_modules/async-listener/index.js:504:23)
at /var/task/node_modules/async-listener/glue.js:188:31
at /var/task/node_modules/async-listener/index.js:541:70
at /var/task/node_modules/async-listener/glue.js:188:31
at process._tickCallback (internal/process/next_tick.js:68:7)
END RequestId: 8813c5b1-1c60-4c06-94f6-8e64f983bfe0
REPORT RequestId: 8813c5b1-1c60-4c06-94f6-8e64f983bfe0  Duration: 5219.77 ms    Billed Duration: 5300 ms Memory Size: 1536 MB   Max Memory Used: 114 MB 

Most helpful comment

I'm experiencing this issue with the latest 1.0.0-55.2 version with Node 12 too. How is everyone working around this?

All 19 comments

also would love to see a working amazon linux 2 build! @adieuadieu

would be greatly in your debt if you could release binaries for amazon linux 2 along side the others!

Also getting this.

I did quite some investigation around this, see https://github.com/alixaxel/chrome-aws-lambda/issues/37

Seems like the only sensible approach is to have an additional Lambda Layer for needed dependencies.

Same. please help.

@erdahuja I've recently published a new version of my package that is compatible with Node 10.

It doesn't need a layer, and there are some issues explaining how to run it with serverless.

What's the version number exactly? I guess i might have tried with latest one only (4 days) ago. I am facing a deadlock of compatibility between chrome binary, puppeteer, serverless and aws lambda. No combination/approach seems to work! and aws rejecting to build the working function on node6x

@erdahuja 2.0.0 - I don't provide support for serverless configurations, but perhaps this helps.

Also, you should use Node 10 - Node 6 and 8 have been or will be discontinued by AWS.

I tried, node 10x, it gets worse. My project is now halted, unable to create new builds.

Also, i tried by fixing the https://github.com/adieuadieu/serverless-chrome/pull/200/files

https://github.com/adieuadieu/serverless-chrome/issues/92, Finally this issue prevails

{socket hang up}

I'm experiencing this issue with the latest 1.0.0-55.2 version with Node 12 too. How is everyone working around this?

I am also running into this issue, v1.0.0-55.3. Anyone able to give us some direction here?

Does this currently work with Node8? I'm trying to get a real basic example working with Serverless & Puppeteer, but I keep hitting this issue.

It works with node v8 locally at least. For v12 I get this error:

The "serverless-plugin-chrome" plugin only supports the Node.js 6.10 or 8.10 runtimes

But when I run serverless deploy with v8.10 I get an error that lambdas no longer support Node v8.

UPDATE: Sorry, I was using v12.7 and it should be v12.x.

@jamesopti - Lambda no longer supports v8:

An error occurred: HelloLambdaFunction - The runtime parameter of nodejs8.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs12.x) while creating or updating functions. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException;

@jamesopti - Lambda no longer supports v8:

Yikes - That's a bummer.

Whats the last known good version of this plugin that I can deploy with Node v10? Or does that not exist?

@elie222 - I found this and it worked perfectly right out of the box - https://github.com/alixaxel/chrome-aws-lambda

Any "actual" solution for this?

Yes. This would be very nice to actually see the steps in format 1,2,3,4

I am experiencing this issue as well:"Error: Unable to start Chrome", any solution for this? @adieuadieu

Why closing this without any solution ?

This is so pointless that the issue has got closed before getting resolved

Was this page helpful?
0 / 5 - 0 ratings