Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.ebextensions config file to load NodeJS EB instance with packages needed for Puppeteer/Chromium
# This is for ElasticBeanstalk with Amazon Linux 2. For previous Linux 1, see revisions for ideas
packages:
yum:
cups-libs: []
dbus-glib: []
libXrandr: []
libXcursor: []
libXinerama: []
cairo: []
cairo-gobject: []
pango: []
# needed for my project, you don't *need* the fonts
liberation-sans-fonts: []
libwayland-client: []
libwayland-cursor: []
gtk3: []
gdk-pixbuf2: []
libxkbcommon: []
libXScrnSaver: []
GConf2: []
atk: []
at-spi2-atk: []
at-spi2-core: []
alsa-lib: []
commands:
refresh-fonts: # this is so liberation-sans gets picked up
command: fc-cache -f -v
@hagi4u
Copy link

hagi4u commented Oct 2, 2018

Thank you!!!
I respect to your to spend a long time.

@SlootSantos
Copy link

SlootSantos commented Nov 14, 2018

@chimmelb how exactly is this going to fix the puppeteer issue?
I'd love to use this extension.. but for some reason it just doesn't work as I still get permission errors.
Do I have to set the "skip chromium installation" env-var?

@rsweny
Copy link

rsweny commented Nov 16, 2018

To fix the permission issue I put a .npmrc in the root of my project. The contents are:

# Force npm to install chrome also as root, preventing permission denied errors in AWS with npm
unsafe-perm=true

@nicolaslopezj
Copy link

nicolaslopezj commented Dec 5, 2018

CentOS mirror is giving 404 on 3 packages. I had to update the urls:

commands:
  atk:
    command: rpm -ivh --nodeps --replacepkgs http://mirror.centos.org/centos/7/os/x86_64/Packages/atk-2.28.1-1.el7.x86_64.rpm
  at-spi2-atk:
    command: rpm -ivh --nodeps --replacepkgs http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-atk-2.26.2-1.el7.x86_64.rpm
  at-spi2-core:
    command: rpm -ivh --nodeps --replacepkgs http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-core-2.28.0-1.el7.x86_64.rpm

@IhsanMujdeci
Copy link

IhsanMujdeci commented May 16, 2019

Can confirm above fix by @rsweny works for elastic beanstalk install of pupetteer.

@giona69
Copy link

giona69 commented Aug 14, 2019

thank you so much it works great!!!

@javierjara
Copy link

javierjara commented Sep 2, 2019

Great

@RobDBob
Copy link

RobDBob commented Nov 1, 2019

Out of date, the atk-2.22.0-3.el7.x86_64.rpm no longer exists under URL. Nerveless, thank you for making the effort.
Updated files:
rpm -ivh --nodeps --replacepkgs http://mirror.centos.org/centos/7/os/x86_64/Packages/atk-2.28.1-1.el7.x86_64.rpm
rpm -ivh --nodeps --replacepkgs http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-atk-2.26.2-1.el7.x86_64.rpm
rpm -ivh --nodeps --replacepkgs http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-core-2.28.0-1.el7.x86_64.rpm

@alexbeletsky
Copy link

alexbeletsky commented Nov 5, 2019

For those who are also looking the solution for "permission" issues of puppeteer npm module installation, here is another config for ebextentions.

npm.config

files:
  "/tmp/.npmrc":
    mode: "000777"
    owner: root
    group: root
    content: |
      //registry.npmjs.org/:_authToken=${NPM_TOKEN}
      unsafe-perm=true

You can remove //registry.npmjs.org/:_authToken=${NPM_TOKEN} line in case if you don't use any private/organizational packages.

@swebal
Copy link

swebal commented Jan 29, 2020

I'm installing via the ebextension script and have added the config files above.

Installation seems to work ok (no errors), but when calling puppeteer.launch (with any option), I get the following error:

(node:8305) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!

/var/app/current/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: /lib64/libdbus-1.so.3: no version information available (required by /usr/lib64/libatk-bridge-2.0.so.0)

/var/app/current/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: /lib64/libdbus-1.so.3: no version information available (required by /usr/lib64/libatspi.so.0)

/var/app/current/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: symbol lookup error:

/var/app/current/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: undefined symbol: g_type_class_adjust_private_offset

I just can't understand how to solve this dependency issue, any help much appreciated!

@pawlarius
Copy link

pawlarius commented Jun 6, 2020

I'm installing via the ebextension script and have added the config files above.

Installation seems to work ok (no errors), but when calling puppeteer.launch (with any option), I get the following error:

(node:8305) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!

/var/app/current/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: /lib64/libdbus-1.so.3: no version information available (required by /usr/lib64/libatk-bridge-2.0.so.0)

/var/app/current/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: /lib64/libdbus-1.so.3: no version information available (required by /usr/lib64/libatspi.so.0)

/var/app/current/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: symbol lookup error:

/var/app/current/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: undefined symbol: g_type_class_adjust_private_offset

I just can't understand how to solve this dependency issue, any help much appreciated!

having the same errors.. it seems from this thread puppeteer/puppeteer#5379, that is issues from puppeteer, and some people said using puppeteer@2.0.0 helps

@ayavilevich
Copy link

ayavilevich commented Jul 22, 2020

Another version change at the repository. had to update to:

commands:
  atk:
    command: rpm -ivh --nodeps --replacepkgs --replacefiles http://mirror.centos.org/centos/7/os/x86_64/Packages/atk-2.28.1-2.el7.x86_64.rpm

@chimmelb
Copy link
Author

chimmelb commented Sep 9, 2020

I just updated this gist for the versions that are currently working for me. Presumably they will become out of a date again.

@xehpuk
Copy link

xehpuk commented Oct 13, 2020

Doesn't work for me:

2020-10-13 22:17:41,853 [ERROR] -----------------------BUILD FAILED!------------------------
2020-10-13 22:17:41,853 [ERROR] Unhandled exception during build: Command libwayland-client failed
Traceback (most recent call last):
  File "/opt/aws/bin/cfn-init", line 171, in <module>
    worklog.build(metadata, configSets)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 129, in build
    Contractor(metadata).build(configSets, self)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 530, in build
    self.run_config(config, worklog)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
    changes['commands'] = CommandTool().apply(self._config.commands)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
    raise ToolError(u"Command %s failed" % name)
ToolError: Command libwayland-client failed

Platform branch: Node.js 10 running on 64bit Amazon Linux 2
Current platform version: 5.2.2

@anthify
Copy link

anthify commented Jan 30, 2021

I can't get this to work as random packages fail install, and even when they don't packages are still required. The process of updating and deploying takes a while. Is there not a simpler more reliable way to do this?

My environment is EBS Amazon Linux 2 and Node 12.

@ValterSantosMatos
Copy link

ValterSantosMatos commented Sep 7, 2021

Same here, not working anymore

@gerardhysa
Copy link

gerardhysa commented Sep 8, 2021

Doesn't work for me:

2020-10-13 22:17:41,853 [ERROR] -----------------------BUILD FAILED!------------------------
2020-10-13 22:17:41,853 [ERROR] Unhandled exception during build: Command libwayland-client failed
Traceback (most recent call last):
  File "/opt/aws/bin/cfn-init", line 171, in <module>
    worklog.build(metadata, configSets)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 129, in build
    Contractor(metadata).build(configSets, self)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 530, in build
    self.run_config(config, worklog)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
    changes['commands'] = CommandTool().apply(self._config.commands)
  File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
    raise ToolError(u"Command %s failed" % name)
ToolError: Command libwayland-client failed

Platform branch: Node.js 10 running on 64bit Amazon Linux 2
Current platform version: 5.2.2

Were you able to find a solution for this ? I am getting the same error

@chimmelb
Copy link
Author

chimmelb commented Sep 15, 2021

We recently moved to Amazon Linux 2 and the upgrade had some changes for this config. (Revision 4)
Available Yum libs made it all a lot easier. I added the comments (prefixed with #) live in this gist, so if they break, remove them!
Linux (1) ideas are in the prior revisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment