puppeteer-stream icon indicating copy to clipboard operation
puppeteer-stream copied to clipboard

getStream fails in Docker with "requested device not found" error

Open arjunByldd01 opened this issue 8 months ago • 2 comments

Hi, thanks for this great library!

I'm facing an issue where everything works fine locally on my machine, but when I run the same code inside a Docker container, I get the following error when trying to start the recording:

Requested device not found

Environment Host: Docker "puppeteer": "^20.9.0", "puppeteer-extra": "^3.3.4", "puppeteer-extra-plugin-adblocker": "^2.13.6", "puppeteer-extra-plugin-stealth": "^2.11.1", "puppeteer-stream": "^3.0.20",

Code

Browser launch:

const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
import { getStream, launch } from 'puppeteer-stream';

private async launchBrowser(): Promise<any> {
  const browser = await launch(puppeteer, {
    headless: false,
    executablePath: '/usr/bin/google-chrome',
    args: [
      '--no-sandbox',
      '--disable-setuid-sandbox',
      '--disable-dev-shm-usage',
      '--disable-web-security',
      '--disable-features=VizDisplayCompositor',
      '--use-fake-ui-for-media-stream',
      '--use-fake-device-for-media-stream',
      '--autoplay-policy=no-user-gesture-required',
      '--mute-audio=false',
      '--window-size=1920,1080',
    ],
    defaultViewport: null,
    ignoreDefaultArgs: ['--disable-extensions', '--mute-audio'],
  });

  return browser;
}

Recording setup:

const savePath = path.join('/app/recordings', `${videoId}-${Date.now()}.webm`);
const file = fs.createWriteStream(savePath);

const stream = await getStream(this.page, { audio: true, video: true });
stream.pipe(file);

arjunByldd01 avatar Aug 05 '25 04:08 arjunByldd01

Can you give more context on the docker environment? Which base image are you using?

If you can post a redacted version of the dockerfile that would be quite helpful

oenu avatar Aug 27 '25 18:08 oenu

@arjunByldd01 you could try to use zenika/alpine-chrome:with-puppeteer as a base image It should have all required dependencies installed

samuelscheit avatar Aug 27 '25 18:08 samuelscheit