Gitlab's autodevops: Herokuish buildpack test can't find chrome binary - gitlab

Gitlab's "autodevops" feature comes with a default step in the 'test' stage called 'test', which uses herokuish to run my rails app's rspec suite. Unfortunately, it fails on my system/integration specs that requires the chrome browser to be installed.
I've tried adding herokuish buildpack install https://github.com/heroku/heroku-buildpack-google-chrome before herokuish buildpack test but it still can't find the Chrome binary. The error looks like the following:
Failure/Error:
visit root_path
Webdrivers::VersionError:
Failed to find Chrome binary or its version.
Any help is appreciated.

Probably a bit too late but here's a working solution as of September 2020.
https://github.com/guzmanoj/herokuish-install-chrome
The script will resolve the chrome dependencies so that CHROME_BIN will be defined in the host OS.

Related

ReactOnRails pre-rendering error after deploying web app with new Ruby and Node versions with Capistrano

Background of the problem
My website is a Rails webapp running the Sharetribe open source code, with Puma & React on Rails to pre-render components. It has a TopBarApp component built by Sharetribe that displays top menus like Home, About, etc.
We recently upgraded the Ruby version from 2.6.2p47 to 2.6.5p114, and Node v7.8.0 to v10.15.3 (npm v6.4.1). After redeploying the new code with Capistrano, theTopbar no longer displays, and we can't access many subpages in our website. We get error msg:
Error during failsafe response: ERROR in SERVER PRERENDERING when prerendering TopbarApp with props
(Full Puma error log | Full Puma access log)
This bug is generated when running the step deploy:assets:precompile with Capistrano deployment. I think have an issue when we build the code client for javascript (css files). Maybe it is not related to Ruby or Node version but something to do with memory when we build.
Checking Chrome developer console gives TypeError: s is not a function
What I have tried
I tried to remove select nvm when Capistrano deploy. My commit:
However, the error is still there because SSH must set npm and node versions.
Any ideas?

React Native Awesome Project Build Fail

Been trying to run the start up AwesomeProject file in VS Code but every time I run npx react-native run-ios...the build fail below comes up. Have looked through the stacks, comments, and questions here but I cannot find anything that is applicable.
Tried to change my terminal and Xcode to load with Rosetta but I get an error there too...
softwareupdate --install-rosetta
Installing Rosetta 2 on this system is not supported.
Not sure where to go from here...
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/********/Library/Developer/Xcode/DerivedData/AwesomeProject-ekivgffrflagyugqmoefmykxoyqy/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-337605CB7CDF90939BEBF863ED22C375.sh (in target 'FBReactNativeSpec' from project 'Pods')
(1 failure)
info Run CLI with --verbose flag for more details.
I had this error too, i searched for hours...
What helped me was to downgrade version of react native to "react-native": "0.62.3" from 0.64
It also works with 0.63.
Others found this helpful: https://github.com/facebook/react-native/issues/32157

How to reduce Puppeteer size

I'm using Puppeteer for webscraping, with a small NodeJs webapp that I made. This webapp is hosted on Heroku and use jontewks/puppeteer-heroku-buildpack to works.
The problem I'm facing is that my app do not build anymore because of the Heroku size limit:
Compiled slug size: 537.4M is too large (max is 500M).
I've tried severals things:
Using Firefox instead of Chromium
It's a "no go" for me because of a current issue with puppeteer/firefox:
Reducing the size of Chromium by removing the file interactive_ui_tests.exe
I can't do this because Heroku use Linux instead of Windows, and this file does not exist in the Linux Chromium distribution
Using headless_shell instead of Chromium
I'm stuck with this (like here) as I do not understand how to make it works. I found the file to use here, but I'm facing the same issue as the comment from the 07/09/2018
Using Playwright instead of Puppeteer
It might be a solution, but I'm using stuffs like puppeteer-extra and puppeteer-extra-plugin-stealth, so it bother me to change
Reducing the size of Chromium by removing the folder locales
It helps a bit, but not much
Using an older version of Puppeteer (2.1.1), which is using an older version Chromium who was slighlty lighter
At the moment, it's the only working solution that I have
Use the command heroku repo:gc -a myapp and heroku builds:cache:purge -a myapp
My last three points reduced the size of my slug to 490M. So my app is working, but it's not great for the (close) future, like having an up to date Puppeteer version.
So here I am, asking for help, as I do not have any more ideas at the moment.
Thank you very much for your help 🙏
Finally, I end up using Playwright.
With this Buildpack, the build of my app is only 250Mb!
Here's a few steps I've followed:
Install with NPM playwright-chromium to only download Chromium.
Set PLAYWRIGHT_BUILDPACK_BROWSERS env variable to chromium in Heroku to only install Chromium dependencies.
Put this buildpack before Node.js buildpack in Heroku.
With this trick you can use most of the of stuff from puppeteer-stealth.
If you want, you can block resources like in Puppeteer:
await page.route('**/*', route => ([
'stylesheet',
'image',
'media',
'font',
// 'script',
'texttrack',
'xhr',
'fetch',
'eventsource',
'websocket',
'manifest',
'other',
].includes(route.request().resourceType()) ? route.abort() : route.continue()))

ChromeNotInstalledError while using chrome-launcher npm package

I am using chrome-launcher for running lighthouse programmatically. It works fine locally but when I run it on azure I am getting an error.
On this statement const chrome = await chromeLauncher.launch({chromeFlags: ['--headless']}); I am getting the following error:
ChromeNotInstalledErrorat new LauncherError (C:\home\site\wwwroot\node_modules\chrome-launcher\dist\utils.js:37:22)at new ChromeNotInstalledError (C:\home\site\wwwroot\node_modules\chrome-launcher\dist\utils.js:68:9){message: 'No Chrome installations found.',code: 'ERR_LAUNCHER_NOT_INSTALLED'}
How can I solve this?
You need to install Chrome on the Azure Function app somehow.
One way to do this is by using an npm dependency that installs Chrome as part of its install process. Examples of this are puppeteer and playwright. Although then you end up with some unnecessary dependencies.
You could also have a startup script or something that installs Chrome before running chrome-launcher/lighthouse. You'll need to tell crome-launcher where Chrome is installed if it's not a standard place using chromePath options or CHROME_PATH environment variable link.
You also have to ensure you do a Remote Build for the Function app.
You will also run into this error, which has a possible workaround: https://github.com/GoogleChrome/chrome-launcher/issues/188
Overall it's not easy. I actually ended up moving my workflow to GitHub Actions instead as Chrome is already installed on their runner images.
See:
https://anthonychu.ca/post/azure-functions-headless-chromium-puppeteer-playwright/

Noflo example : Running inside browser

We are trying to get a simple noflo example running inside a browser as described the noflojs.org/documentation/fbp/ [Language for Flow-Based Programming]
We tried to refer to some examples available on GitHub
github.com/noflo/noflo-browser-app
github.com/noflo/noflo-websocket
github.com/bergie/flowcopter
We tried npm install; grunt build. We get the below error and are not able to proceed beyond this:
Running "noflo_browser:build" (noflo_browser) task install
noflo/noflo#master Warning: dns lookup failed Use --force to
continue.
Any idea what are we missing ?
At the time of the question the build setup for the projects mentioned was still based on Component.js which had become unmaintained.
Nowadays we're using NPM for installing dependencies and WebPack for browser builds.
Suggested fix would be to fetch the latest versions of these repos, do npm install and build again. This will bring the build up to spec.
If you're using the old build setup in your own projects, this PR is a handy example on what to change to go from Component.js to WebPack.

Resources