(node:16064) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: net::ERR_CERT_AUTHORITY_INVALID at https://10.1.40.117/print/d37a2017-4bc4-46fb-9a8a-7ddc31e65a33
(node:16064) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I believe there might be a problem with the SSL certificate, but I don’t know the best way to manage this. Can anyone provide guidance on how to fix this issue?
I encountered a similar issue with self-signed certificates on internal sites. By default, Puppeteer’s Chromium does not load pages with invalid SSL certificates, which is why you’re seeing the ERR_CERT_AUTHORITY_INVALID error. To resolve this, you can add the --ignore-certificate-errors flag when launching the browser instance. Here’s an example of how you can implement it:
Although using --disable-web-security is an option, it is not recommended for production environments due to security risks. Additionally, consider wrapping your async function in a try-catch block to manage any other potential promise rejections. This approach has worked effectively for me on development servers.
ssl certs with internal ips are a pain. try using --ignore-ssl-errors and --insecure along with the cert flags. also, remember to catch those promises! even with the flags, .catch(console.error) at the end of your iife or wrapping in try/catch blocks works well.
This SSL issue frequently arises in development or internal environments. While the previous suggestion to use --ignore-certificate-errors is effective, consider also using the --allow-insecure-localhost option for added flexibility. Additionally, I wrap my main function in a try-catch block or use a .catch() method to handle exceptions properly. This approach ensures that if the SSL flags don’t resolve the issue, your application won’t crash unexpectedly. My experience shows that combining these flags with robust error handling leads to more stable performance in production-like scenarios.