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

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	

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 9
  • Comments: 19 (3 by maintainers)

Most upvoted comments

Why closing this without any solution ?

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

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

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

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!

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.