Puppeteer Snap CGroup Error - Chrome Browser on Ubuntu 22.04

Published in Bug on Aug 23, 2023

If you are trying to get Puppeteer to work on Ubuntu 22 and running into a Snap CGroup / Permission denied issue.

Error Output:
================
Error: Failed to launch the browser process!
2023/08/23 09:36:26.831206 cmd_run.go:1055: WARNING: cannot start document USER: dial unix /run/user/0/bus: connect: permission denied
/user.slice/user-0.slice/session-158.scope is not a snap cgroup

I had ran into the above issue recently, I had followed many previous steps and installed chrome-browser but this also Installs the "chromium" snap package, but this is the incorrect version we want.

Go ahead and run the following and install the dev version.

snap remove chromium

snap install --devmode chromium

This should hopefully remove the above permission/snap issues.