sPavl0v / react-spa-prenderer

MIT License
33 stars 17 forks source link

Args "--no-sandbox" not working #5

Open fadilnatakusumah opened 2 years ago

fadilnatakusumah commented 2 years ago

Hi, I try to use react-spa-prerender to build my static HTML files. it works, but when I use it with Docker, it would give me this error

315.9 /app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:197

18 315.9 reject(new Error([

18 315.9 ^

18 315.9

18 315.9 Error: Failed to launch the browser process!

18 315.9 [1122/162528.703690:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.`

already using launchOptions config from the doc but still not working from me

fadilnatakusumah commented 2 years ago

here is my Dockerfile

 FROM node:15.2.1 AS build

WORKDIR /app
ADD . /app

RUN apt-get update

# for https
RUN apt-get install -yyq ca-certificates
# install libraries
RUN apt-get install -yyq libappindicator1 libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6
# tools
RUN apt-get install -yyq gconf-service lsb-release wget xdg-utils
# and fonts
RUN apt-get install -yyq fonts-liberation 
# and chromium
RUN apt-get install -yyq chromium 

RUN yarn
RUN yarn build-staging

# STAGE-2
# Production image, copy all the files and run
FROM node:15.2.1-alpine

WORKDIR /app
COPY --chown=node:node --from=build /app /app

RUN yarn global add serve && chown -R node:node .

USER node
ENTRYPOINT ["serve"]
CMD ["-s","build"]

is any other workaround for this problem?

sPavl0v commented 2 years ago

Hi @fadilnatakusumah, thanks for reporting this issue. I'll figure it out as soon as possible and push the fix/write the way to workaround.

ahaghdan commented 2 years ago

HI @sPavl0v, I think the information on this page can help you fix this bug, please read the docker related part.

https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

shapeshifta78 commented 2 years ago

Did you add --no-sandbox within the configuration? The error message states exactly that and it is also explained in your link https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#setting-up-chrome-linux-sandbox