I have a node application that uses puppeteer to test a web site. Up until we updated to latest puppeteer 1.12.2 we had no problem.
In the Firewall tab of the "Security and Privacy" settings, ACCEPT is specifically set for Chromium. (and we've tried turning it off too) There seems to be no pleasing MacOS on this point.
Any suggestions about how to quiet MacOS and recognize/persist the firewall preference?
We were having the same issue after upgrade our puppeteer and MacOS. One solution we have is to instruct puppeteer to use our own Chrome instead of the bundled chromium by specifying the executablePath
. Below is a Typescript snippet how we specify it. Same thing if you use vanilla JS
.
Sometimes that still is not enough, we have to make headless
option false to make it consistently work, which is really annoying.
/**
* create a puppeteer 'Browser' object.
*/
public static createBrowser(): Promise<Browser> {
return puppeteer.launch({
// ... other options
headless: false,
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
});
}
Hope it also works for you. :-)
Another option is self sign a certificate, follow the instructions in this comment:
https://github.com/GoogleChrome/puppeteer/issues/4752#issuecomment-524086077
Here in more detail how to open the Certificate creator: https://support.apple.com/en-gb/guide/keychain-access/kyca2686/mac)
And then in the root of your repo run:
sudo codesign -s MyCertificateName -f ./node_modules/puppeteer/.local-chromium/mac-674921/chrome-mac/Chromium.app --deep
In my case it was using a globally installed version of chromium (from playwright). So the following command worked in signing it:
global chromium
sudo codesign --force --deep --sign - ~/Library/Caches/ms-playwright/chromium-*/chrome-mac/Chromium.app
If you don't use a global chromium install, the following might work
local project chromium
sudo codesign --force --deep --sign - ./node_modules/puppeteer/.local-chromium/mac-*/chrome-mac/Chromium.app
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