heroku-playwright-example icon indicating copy to clipboard operation
heroku-playwright-example copied to clipboard

Error on Init : "error while loading shared libraries"

Open CyberV opened this issue 4 years ago • 1 comments

Hi team,

First of all, THANK YOU SOOO MUCH for this wonderful library. Loving it!

I have been using the heroku playwright buildpack for the past 1 year and was running smoothly on the heroku app. A week back, I started running into the following issue on App Build.

Build Error on Server. Works flawlessly on local. (y)

Aug 30 23:26:53 autom8 app/web.1 == ERROR in Playwright Init == { Protocol error (Target.setAutoAttach): Target closed. Aug 30 23:26:53 autom8 app/web.1 =================== chromium.launch logs =================== Aug 30 23:26:53 autom8 app/web.1 /app/node_modules/playwright-chromium/.local-browsers/chromium-775089/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/tmp/playwright_chromiumdev_profile-xFUfUO --remote-debugging-pipe --no-sandbox --no-startup-window Aug 30 23:26:53 autom8 app/web.1 pid=35 Aug 30 23:26:53 autom8 app/web.1 /app/node_modules/playwright-chromium/.local-browsers/chromium-775089/chrome-linux/chrome: error while loading shared libraries: libxcb-dri3.so.0: cannot open shared object file: No such file or directory Aug 30 23:26:53 autom8 app/web.1 <process did exit: exitCode=127, signal=null> Aug 30 23:26:53 autom8 app/web.1 ============================================================ Aug 30 23:26:53 autom8 app/web.1 Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.Error Aug 30 23:26:53 autom8 app/web.1 at Promise (/app/node_modules/playwright-chromium/lib/chromium/crConnection.js:132:63) Aug 30 23:26:53 autom8 app/web.1 at new Promise () Aug 30 23:26:53 autom8 app/web.1 at CRSession.send (/app/node_modules/playwright-chromium/lib/chromium/crConnection.js:131:16) Aug 30 23:26:53 autom8 app/web.1 at CRSession.send (/app/node_modules/playwright-chromium/lib/helper.js:65:31) Aug 30 23:26:53 autom8 app/web.1 at Function.connect (/app/node_modules/playwright-chromium/lib/chromium/crBrowser.js:57:27) Aug 30 23:26:53 autom8 app/web.1 at Chromium._connectToTransport (/app/node_modules/playwright-chromium/lib/server/chromium.js:52:38) Aug 30 23:26:53 autom8 app/web.1 at Chromium._innerLaunch (/app/node_modules/playwright-chromium/lib/server/browserType.js:86:36) Aug 30 23:26:53 autom8 app/web.1 message: Aug 30 23:26:53 autom8 app/web.1 'Protocol error (Target.setAutoAttach): Target closed.\n=================== chromium.launch logs ===================\n /app/node_modules/playwright-chromium/.local-browsers/chromium-775089/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/tmp/playwright_chromiumdev_profile-xFUfUO --remote-debugging-pipe --no-sandbox --no-startup-window\n pid=35\n/app/node_modules/playwright-chromium/.local-browsers/chromium-775089/chrome-linux/chrome: error while loading shared libraries: libxcb-dri3.so.0: cannot open shared object file: No such file or directory\n<process did exit: exitCode=127, signal=null>\n============================================================\nNote: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.' }

image

Package.json:

{ "name": "heroku-playwright-example", "version": "1.0.0", "description": "Example how you can use Playwright on Heroku", "scripts": { "start": "node src/index.js" }, "repository": { "type": "git", "url": "git+https://github.com/mxschmitt/heroku-playwright-example.git" }, "keywords": [], "author": "", "license": "ISC", "bugs": { "url": "https://github.com/mxschmitt/heroku-playwright-example/issues" }, "homepage": "https://github.com/mxschmitt/heroku-playwright-example#readme", "dependencies": { "cors": "^2.8.5", "crypto-js": "^4.0.0", "express": "^4.17.1", "node-fetch": "^2.6.1", "nodemon": "^2.0.3", "playwright-chromium": "^1.1.1", "playwright-firefox": "^1.1.1", "request": "^2.88.2" }, "engines": { "node": "10.13" } }

Playwright Init Code:

browser = await { chromium, firefox }[browserName].launch(browserName === "chromium" ? { args: ['--no-sandbox'], chromiumSandbox: false, headless: true } : {});

  • I found some posts pointing to an issue with Nodev.14.0 and tried setting node version on heroku to mirror my local environment but same error.
  • I checked the demo app in repo and it seems to be working fine

Any idea what can be causing this?

CyberV avatar Aug 31 '21 06:08 CyberV

@CyberV do following

  1. Add Nodejs Buildpack
heroku buildpack:set https://github.com/heroku/heroku-buildpack-nodejs
  1. Add Playwright Buildpack at Index 1
heroku buildpacks:add --index 1 https://github.com/mxschmitt/heroku-playwright-buildpack.git

Then push.

vikas5914 avatar Dec 02 '21 13:12 vikas5914