react-snap: Unable to deploy to Heroku with create-react-app-buildpack

When deploying I am getting this error, which actually seems to freeze the build process on Heroku:

(node:629) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to launch chrome!
/tmp/build_2e66391b352738bb3c9a1b44c5632458/jesshmusic-living_music_database-ca09d15273a13f10f1a1a9e7ffd147503a55dc26/node_modules/react-snap/node_modules/puppeteer/.local-chromium/linux-499413/chrome-linux/chrome: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
(node:629) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have attempted to add the puppeteer build pack as described in the troubleshooting link above but it doesn’t do any good. Does anyone have a solution to get this to deploy in Heroku? If it is something I missed in the docs kindly point me in that direction.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

I’m surprised that following code didn’t help you. But you figured it out anyway so 👍

"reactSnap": {
   "puppeteerArgs": ["--no-sandbox", "--disable-setuid-sandbox"]
}

Main part of the log which you want to pay attention is:

/bin/sh: 1: react-snap: not found

Did you add react-snap to the dependencies? If issue is not solved, please open new ticket (to not spam people in this thread) and post contents of package.json

This is what I got

git clone https://github.com/stereobooster/an-almost-static-stack.git
cd an-almost-static-stack
git checkout react-snap-heroku
heroku create
heroku config:set NPM_CONFIG_PRODUCTION=false
heroku buildpacks:add https://github.com/jontewks/puppeteer-heroku-buildpack.git
heroku buildpacks:add heroku/nodejs
heroku buildpacks:add https://github.com/heroku/heroku-buildpack-static.git
git push heroku react-snap-heroku:master -f

...

remote:        $ react-snap && yarn run generate-sw && yarn run generate-appcache
remote:        (node:432) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to launch chrome!
remote:        /tmp/build_63bedf583edd7573cdc7d8cc8546b619/node_modules/puppeteer/.local-chromium/linux-555668/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory
remote:
remote:
remote:        TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
remote:
remote:        (node:432) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I guess you need heroku config:set NPM_CONFIG_PRODUCTION=false, because react-snap listed as devDependecy.

About issue with libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory you need to ask in jontewks/puppeteer-heroku-buildpack. It was working sometimes ago.

@jamez14 yes my example worked. You can clone repo, checkout branch and try it. I didn’t push it to the master because Heroku uses HTTP1.

Pagerror - means that error happened inside the headless browser, what would you see in DevTools in chrome. Try build with react-snap, to see if this Heroku specific or not. You can open separate issue if you can provide reproducible demo, otherwise I can not do much about it