I use an Azure VM on ubuntu 20.04. I would like to set up puppeteer sharp on this VM to use it with my dotnet core API.
But, I awlays have this error :
Failed to launch browser! [0408/085321.321602:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
If I run "sudo chromium", I have this error :
zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
If I run "sudo chromium --no-sandbox", I have some error messages but, chromium is launched.
In my dotnet core API, I wrote :
await new BrowserFetcher().DownloadAsync();
var launchOptions = new LaunchOptions
{
Headless = true,
ExecutablePath = "/snap/bin/chromium",
Args = new[] { "--no-sandbox", "--disable-setuid-sandbox" },
};
var browser = await Puppeteer.LaunchAsync(launchOptions);
_logger.LogError(launchOptions.ToString());
var page = await browser.NewPageAsync();
await page.SetContentAsync(htmlContent);
I got this error :
Failed to launch browser! [0408/085321.321602:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
I don't understand why as I correctly passed "--no-sandbox" argument to LaunchAsync method. When you read my manual tests, It seems that --no-sandbox is ignored.