Skip to content

Unable to deploy to Heroku with create-react-app-buildpack #60

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jesshmusic opened this issue Dec 2, 2017 · 17 comments
Closed

Unable to deploy to Heroku with create-react-app-buildpack #60

jesshmusic opened this issue Dec 2, 2017 · 17 comments
Labels

Comments

@jesshmusic
Copy link

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.

@stereobooster
Copy link
Owner

stereobooster commented Dec 2, 2017

I didn't try to deploy it to heroku, but quick googling gave me this recomendation:

"puppeteerArgs": ["--no-sandbox", "--disable-setuid-sandbox"]

Did you tried it?

PS. obviously you need heroku buildpack for puppeteer

@jesshmusic
Copy link
Author

Thanks for your help, but I still can't get it to deploy, same error. It doesn't ever download the buildpack for puppeteer, so at this point I'm confounded. Adding puppeteerArgs didn't help either, it seems like it just isn't getting the buildpack at all, which is odd. Much more likely that this issue is just me not knowing what I'm doing with this kind of deploy.

@stereobooster
Copy link
Owner

What heroku buildpacks says?

@jesshmusic
Copy link
Author

Here are the build packs returned from the CLI command:

1. https://github.com/jontewks/puppeteer-heroku-buildpack.git
2. https://github.com/mars/create-react-app-buildpack.git

@stereobooster
Copy link
Owner

stereobooster commented Dec 2, 2017

Looks as it suppose to be. Maybe crosspost the issue to those buildpack repositories?..

  1. Can't get Heroku to load this buildpack jontewks/puppeteer-heroku-buildpack#7

@stereobooster
Copy link
Owner

Will close this for now. Feel free to reopen

@stereobooster
Copy link
Owner

stereobooster commented Dec 31, 2017

create-react-app-buildpack - uses some magic with multi buildpack. Have you tried packages inside directly?

UPD: my try stereobooster/an-almost-static-stack#7

@jamesmosier
Copy link

@stereobooster were you able to get your heroku example working?

I got puppeteer running on my heroku instance but am receiving a nondescript error:

screen shot 2018-01-07 at 10 13 31 pm

(Also if it would be better, I can open up a new issue for this, but Error: i didn't seem like enough to go on)

@stereobooster
Copy link
Owner

@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

@jamesmosier
Copy link

I haven't done any further testing, but I mentioned previously that I was not able to build/deploy with Heroku. I then forked react-snap and manually added the puppeteer args and then react-snap succeeded on Heroku. This might just be because of my project setup, but regardless someone else might find this useful.

@stereobooster
Copy link
Owner

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

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

@heshamelmasry77
Copy link

heshamelmasry77 commented May 10, 2018

hey so i tried to do the same what you guys did but i still can't deploy at all
i added this to my package.json

"reactSnap": {
  "puppeteerArgs": ["--no-sandbox", "--disable-setuid-sandbox"],
  "concurrency": 1,
  "inlineCss": false,
  "puppeteerExecutablePath": "/usr/bin/chromium-browser"
} 

and here is my log

       yarn global add serve
       serve -s build
       
       $ react-snap
/bin/sh: 1: react-snap: not found
error Command failed with exit code 127.
       info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
       info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       If you're stuck, please submit a ticket so we can help:
       https://help.heroku.com/ 

@stereobooster
Copy link
Owner

stereobooster commented May 10, 2018

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

@heshamelmasry77
Copy link

heshamelmasry77 commented May 10, 2018

@Jamez14
so i have edited the same you told me

 "reactSnap": {
    "puppeteerArgs": ["--no-sandbox", "--disable-setuid-sandbox"],
    "concurrency": 1,
    "inlineCss": false,
    "puppeteerExecutablePath": "/usr/bin/chromium-browser"
  }
 "scripts": {
    "build-css": "node-sass-chokidar src/ -o src/",
    "watch-css": "yarn run build-css && node-sass-chokidar src/ -o src/ --watch --recursive",
    "start-js": "react-scripts start",
    "serve": "yarn npm-run-all -p watch-css start-js",
    "heroku-postbuild": "yarn --production=true && yarn run build",
    "build-js": "react-scripts build",
    "build": "npm-run-all build-css build-js",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "flow": "flow",
    "postbuild": "react-snap"
  }

but i get the same error sadly

yarn global add serve
       serve -s build
       
       $ react-snap
/bin/sh: 1: react-snap: not found
error Command failed with exit code 127.
       info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
       info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       If you're stuck, please submit a ticket so we can help:
       https://help.heroku.com/
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

@stereobooster
Copy link
Owner

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.

@heshamelmasry77
Copy link

@stereobooster
I disabled set the config to false like how you said and now i get the same error you get.

@heshamelmasry77
Copy link

solution for this
jontewks/puppeteer-heroku-buildpack#13 (comment)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants