Im using Laravel 10 with laravel spatie browsershot to take a screenshot of a specific url in my website and transform it into a pdf file. All is working fine on my locale machine. After pulling on the live server which is a ubuntu server, i test the function on tinker as the root user and it works fine. But when i access the website from my browser and clicking the button that generates the pdf im getting the following error:
Error: Failed to launch the browser process! cmd_run.go:1046: WARNING: cannot create user data directory: cannot create snap home dir: mkdir /var/www/snap: permission denied /system.slice/php8.1-fpm.service is not a snap cgroup TROUBLESHOOTING: https://pptr.dev/troubleshooting at Interface.onClose (/var/www/mywebsite/node_modules/@puppeteer/browsers/lib/cjs/launch.js:262:24) at Interface.emit (node:events:525:35) at Interface.close (node:internal/readline/interface:536:10) at Socket.onend (node:internal/readline/interface:262:10) at Socket.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1359:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
how can i fix the permissions? i tried setting the www directory with root:www-data and still no fix.