We are running a Node.js backend on a Windows Server with PM2
. For PDF generation we use Puppeteer
.
Chromium started with pm2 as Local Service user uses wrong temp folder
Current installation:
PM2 is running as Service installed by using pm2-installer
https://github.com/jessety/pm2-installer) (using the offline installer, as the target is a windows server without internet). This PM2 starts a node application which starts a puppeteer-Chromium instance.
So this Chrome is running with the Local Service user.
Puppeteer is started using a specific userDataDir.
The Problem is now that Puppeteer tries to write to C:\Users\Administrator\AppData\Local\Temp\...
where it does not have the permissions to write to as it is not running as Administrator.
Chrome debug log says: Failed to create temporary file
So the questions are:
You can configure the temp directory by overriding the PUPPETEER_TMP_DIR
environment variable. See their README for more information.
https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#environment-variables
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With