remotion-dev / remotion

🎥 Make videos programmatically with React

Home Page:https://remotion.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Failed to launch the browser process!` in docker container

greffgreff opened this issue · comments

Hi. I'm currently self-hosting my personal computer as a Github runner for a private repository of mine to render videos at a lower cost but I am getting the following error:

/home/docker/actions-runner/_work/renderer-api/renderer-api/node_modules/@remotion/renderer/dist/browser/BrowserRunner.js:255
            reject(new Error([
                   ^
Error: Failed to launch the browser process!
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
    at onClose (/home/docker/actions-runner/_work/renderer-api/renderer-api/node_modules/@remotion/renderer/dist/browser/BrowserRunner.js:255:20)
    at ChildProcess.<anonymous> (/home/docker/actions-runner/_work/renderer-api/renderer-api/node_modules/@remotion/renderer/dist/browser/BrowserRunner.js:246:24)
    at ChildProcess.emit (node:events:530:35)
    at ChildProcess._handle.onexit (node:internal/child_process:2[9](https://github.com/greffgreff/renderer-api/actions/runs/8881586278/job/24384296236#step:7:10)4:12)

While I would have attempted to troubleshoot a bit longer, I couldn't find a way to increase verbose to get a more precise error.

The github action that I am running looks very similar to that of remotion:

name: Render video
on:
  workflow_dispatch:
  release:
    types: [created]
jobs:
  render:
    name: Render video
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@main
      - uses: actions/setup-node@main
      - run: sudo apt-get update -y
      - run: sudo apt-get install ffmpeg -y
      - run: npm i
      - run: npm run render
      - uses: actions/upload-artifact@v4
        with:
          name: out.mp4
          path: out/video.mp4

And if that helps, here is the Dockerfile that I am using as self-hosted runner for the github actions:

FROM ubuntu:latest

ARG RUNNER_VERSION="2.316.0"

ENV DEBIAN_FRONTEND noninteractive

RUN apt update -y \
    && apt upgrade -y
    
RUN apt-get -y install sudo curl jq npm \
    && apt-get clean

RUN curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - \
    && apt-get install -y nodejs

RUN adduser --disabled-password --gecos '' docker \
    && adduser docker sudo \
    && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

RUN cd /home/docker && mkdir actions-runner && cd actions-runner \
    && curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \
    && tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz

RUN chown -R docker ~docker && /home/docker/actions-runner/bin/installdependencies.sh

COPY start.sh start.sh

# make the script executable
RUN chmod +x start.sh

# since the config and run script for actions are not allowed to be run by root,
# set the user to "docker" so all subsequent commands are run as the docker user
USER docker

ENTRYPOINT ["./start.sh"]

From @JonnyBurger:

@greffgreff What is the output when adding --log=verbose?

Try the newest version and

npx remotion browser ensure

to download a browser that should be guaranteed compatible

So i updated the workflow file to include --log=verbose and added npx remotion browser ensure before rendering but the error persists:

name: Render video
on:
  workflow_dispatch:
  release:
    types: [created]
jobs:
  render:
    name: Render video
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@main
      - uses: actions/setup-node@main
      - run: sudo apt-get update -y
      - run: sudo apt-get install ffmpeg -y 
      - run: npm i
      - run: npx remotion browser ensure
      - run: npm run render --log=verbose
      - uses: actions/upload-artifact@v4
        with:
          name: out.mp4
          path: out/video.mp4

PS The browser shell installs without producing an error.

@greffgreff Does --log=verbose produce any additional output? That could be handy

If you just want a Docker image that works, we provide one here: https://www.remotion.dev/docs/docker

You might also have to install the libraries mentioned under https://www.remotion.dev/docs -> Additional info for Linux -> Ubuntu

Hello @JonnyBurger thanks for the replies. Adding --log=verbose did not produce any new logs.

You might also have to install the libraries mentioned under https://www.remotion.dev/docs -> Additional info for Linux -> Ubuntu

I am running a barebone ubuntu instance so the libs mentioned in the doc are probably not installed. I'll give that a try.

Alright!

I noticed one more thing, --log=verbose gets swallowed by npm. You need to add it to the Remotion command: npx remotion render --log=verbose

Thanks for spotting this.

@JonnyBurger Ok the issue was indeed missing packages that are mentioned in the documentation!
For those wondering I had to run the following install command:

apt install gconf-service 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 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 ca-certificates fonts-liberation libnss3 lsb-release xdg-utils wget libgbm-dev

Also, I had to downgrade my ubuntu version from 24.04 to 20.04 as some of the libraries mentioned above are not yet available for the newest version of unbuntu at the time of writting.

Great!

You shouldn't have run into such a hard to debug case.
We replaced the error message with one that links to this new article: https://www.remotion.dev/docs/troubleshooting/browser-launch

Which mentions the problem you had.