Nacl Helper Process Running Without a Sandbox! Error When Running Npm Tests

I'n having a problem when running some npm test. The error I'm receiving is: "NaCl helper process running without a sandbox!", which is true, as I'm running the browser with the "--no-sandbox" option. I have to run this option due to the fact that the browser runs as root, and I don't have an option to run it a different user at all(it's a docker image). Can anyone please help me to sort it out?

P.S I'm installing the browser in the following way:

RUN apt-get update
RUN apt-get install -y nodejs npm
RUN wget -q -O -  | apt-key add -
RUN sh -c 'echo "deb  stable main" >> /etc/apt/sources.list.d/google.list'
RUN apt-get install -y apt-transport-https
RUN apt-get update
RUN apt-get install -y google-chrome-stable

Thanks in advance!

2 Answers

This error message...

NaCl helper process running without a sandbox!

...implies that you have no setuid sandbox in your system, hence the program was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.


Solution

A quick solution will be, if you want to run Chrome and only use the namespace sandbox, you can set the flag:

--disable-setuid-sandbox

This flag will disable the setuid sandbox (Linux only). But if you do so on a host without appropriate kernel support for the namespace sandbox, Chrome will not spin up. As an alternative you can also use the flag:

--no-sandbox

This flag will disable the sandbox for all process types that are normally sandboxed.

Example:

chromeOptions: {
      args: ['--disable-setuid-sandbox', '--no-sandbox']
},

You can find a detailed discussion in Security Considerations - ChromeDriver - Webdriver for Chrome


Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.