Any chance to have the dependencies needed for Chromium installed on the server (cloud version)?

Hi!

I’m trying Activepieces out to see if it could help me with automatic testing of an SPA.

I’m thinking of using Chromium together with Playwright, Puppeteer or Nightmare in a Code piece.

Now, after installing Chromium using NPM I get the following error when trying to open a website with Chromium:

error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

Any change of having the dependencies needed for chromium installed on the Activepieces server?

I think this would open up a bunch of interesting uses of Activepieces: Automated UI testing, Browser automation and SPA web scraping.

All the best,
Frazze

Hi @Frazze I tried adding a code step and added chromium as an npm package and ran a simple code using it and it worked, maybe this problem with the many updates we have rolled out since this post, apologies for the delayed response.

import * as c from 'chromium'
import {execFile} from 'child_process';
export const code = async (inputs) => {
    execFile(c.path, ['https://google.com'], err => {
	console.log('Hello Google!');
});
  return c;
};

Could you please tell us about what code you were trying to run ?

Hi @Abdul !

Thanks for reaching out.

I’m trying to run the following code:

import * as c from 'chromium';
import puppeteer from 'puppeteer';
export const code = async (inputs) => {
    const browserTest3 = await puppeteer.launch({ executablePath: c.path });
}

This results in the following response:

"Failed to launch the browser process!
(…) Error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory.

I started trying with the more basic:

const browserTest1 = await puppeteer.launch();

and

const browserTest2 = await puppeteer.launch({headless: "new"});

But those two calls fails, saying it cannot find Chrome.

Thanks for helping me out.

All the best,
Johan

@Frazze

I was playing around this but got it somehow get past the previous issue you’re having but it’s complaining about error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory;

Here’s the relevant code when I launch using Playwright.

import { chromium } from 'playwright';
import chromiumPath from 'chromium';

export const code = async (inputs) => {
    console.log(chromiumPath.path);
  const browser = await chromium.launch({ executablePath: chromiumPath.path });

...

Same error when I launch using Puppeteer:

import puppeteer from 'puppeteer';
import chromiumPath from 'chromium';

export const code = async (inputs) => {
  const browser = await puppeteer.launch({
    executablePath: chromiumPath.path
  });

...

@Abdul is it possible to install this library on the server? libnss3

Hi @menacestudio !

Thanks for posting your findings - for a while I thought I was the only one having issues with this.

Hope that @Abdul and crew can find a solution soon - would be really cool to get Playwright / Puppeteer to run!

Chiming in to say that I am having the same issue when using puppeteer – Error: Could not find Chrome…

Any update on this? thanks!

1 Like

Hi,

I haven’t updated the ticket here. We spent a great time figuring this out, but the issue is that Chrome/Firefox requires certain permissions that are dangerous to give. also we have two sand-boxing modes to make it easy to be self hostable, we need a specific configuration for each environment.

TL;DR: We are still looking for a way to introduce it without breaking security best practices. So, we postponed it a little, as this is not straightforward.

3 Likes

I’m stuck on this also with Puppeteer, would love to use it on activepieces, it will help me a lot to automate things :slight_smile:

1 Like

Ok I found a workaround : connect to a remote chrome that you host on a docker server.
GitHub - browserless/browserless: Deploy headless browsers in Docker. Run on our cloud or bring your own. Free for non-commercial uses.

I hosted it on a 6$ digitalocean droplet and it works perfectly
Then to instanciate your browser with puppetter, just use this line :

const browser = await puppeteer.connect({ browserWSEndpoint: 'ws://YOUR_SERVER_IP:3000/chrome' });
2 Likes

Hi @yann120,

That’s a really clever solution. Thanks for sharing!

Hi @yann120

Your solution is elegant!

Do you mind post it on Tutorials, It will be great addition there!

Thank you,
Mo.

For anyone landing here now: you no longer need Chromium inside a Code step. Activepieces has a Browserless piece that does what yann120 described without writing the connect code yourself.

Run Puppeteer Function takes an ES module whose default export receives { page, context } and returns { data, type }, so most existing Puppeteer code moves over with small changes. For the common jobs there are ready actions: Capture Screenshot (PNG, JPEG or WebP, full page, viewport size, wait for a selector, delay) and Generate PDF (from a URL or from a raw HTML string, with paper format, margins and print background).

The connection has a region dropdown for the hosted service plus a Custom Endpoint option, so a self hosted Browserless container like the one on a small droplet works too. Put its base URL there and keep your token.

Each call is a fresh browser session, so pass any values your test needs (login, target URL) through Context rather than expecting state to carry over between steps.

(Disclosure: I’m connected to thirds.ai.)