The website I am trying to access has ssl certificate-errors
I am using this version of puppeteer "puppeteer": "1.13.0".
When I try to await page.goto('http://bad_ssl_certificate_website') I have timeout error on google cloud only.
TimeoutError: Navigation Timeout Exceeded:
However, It works perfectly fine locally on MAC.
I think the problem is ssl-certificate-errors for my website, because if I try with "google.com" it works okay in both environments.
I used https://www.sslshopper.com to check ssl certificates,and It mentioned this.
The certificate is not trusted in all web browsers. You may need to
install an Intermediate/chain certificate to link it to a trusted root
certificate. Learn more about this error. You can fix this by
following DigiCert's Certificate Installation Instructions for your
server platform. Pay attention to the parts about Intermediate
certificates.
When I was using older version of puppeteer I had problems locally as well.
I saw the exactly the same error
'TimeoutError: Navigation Timeout Exceeded:'
Updating to the newest version of puppeteer has fixed only running the puppeteer locally, but it has not fixed the puppeteer running on google cloud
This is how I setup puppeteer to lunch.
const browser = await puppeteer.launch({
headless: true,
ignoreHTTPSErrors: true,
args: [
"--proxy-server='direct://'",
'--proxy-bypass-list=*',
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
'--no-first-run',
'--no-sandbox',
'--no-zygote',
'--single-process',
'--ignore-certificate-errors',
'--ignore-certificate-errors-spki-list',
'--enable-features=NetworkService'
]
});
I found some related issues:
https://bugs.chromium.org/p/chromium/issues/detail?id=877075
Just turn .IgnoreHTTPSErrors = True in the LaunchAsync constructor.
Example:
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);
var browser = await Puppeteer.LaunchAsync(new LaunchOptions()
{
Headless: true,
IgnoreHTTPSErrors: true
});
The --ignore-certificate-errors-spki-list actually accepts a whitelist of public key hashes ignore certificate-related errors. So it is used like: --ignore-certificate-errors-spki-list=jc7r1tE54FOO=
Chromium doc
Related
I am using a puppeteer plugin that opens a webserver when I need to manually solve a captcha. The below code works in development, but I can't figure out an approach to get it to work in production.
I am deploying this app on render.com, and as far as I know, I can only listen to one port.
const app = express();
app.listen(process.env.PORT || "3000");
// I eventually get a link like this
// http://localhost:3001/?targetId=68C3007E851659A5D54CD6E023022C91
puppeteer.use(
PortalPlugin({
// This is a typical configuration when hosting behind a secured reverse proxy
webPortalConfig: {
listenOpts: {
port: 3001,
},
baseUrl: "http://localhost:3001",
},
})
);
I've tried making the port the same on both servers but as expected I kept getting the "port already in use" error. I've also tried pointing the base url to my render.com URL, but it times out when I navigate to the url supplied by the plugin.
Background: Here is my situation, I have a website I access that requires me to go through a proxy. For day-to-day use, I installed the chrome extension Proxy switchyomega to switch between proxies based on a URL wildcard. For example, when I go to URL abc.xyz.com my company requires me to use a proxy at x.x.x.x:yyyy.
Issue I am trying to write an automation script using WebdriverIO (version 7.24.0) in standalone mode using chrome that will launch the website abc.xyz.com. The problem is when I run the script it is not going through the proxy, so my access is blocked. I have tried to configure a proxy in the capabilities but that does not seem to work, and I'm wondering if I'm doing something wrong in my configuration, which is below
const { remote } = require("webdriverio");
const browser = await remote({
capabilities: {
browserName: "chrome",
proxy: {
proxyType: "manual",
httpProxy: "x.x.x.x:yyyy"
}
},
});
await browser.url("abc.xyz.com");
As mentioned in normal use when I access URL abc.xyz.com it routes through the x.x.x.x:yyyy proxy and that is what I need to happen when running my script but the above configuration does not seem to do anything.
Any help would be appreciated.
I'm new to Progressive Web Apps, and I'm adding a Service Worker to my app for the very first time. It's a simple Service Worker, with my goal being purely to test that it is being registered properly. The file is serviceWorker.js:
console.log('Hello Service Worker');
I'm adding this to an application that I'm running with the Webpack Dev Server. I'm using a self-signed certificate locally with it. I setup the Service Worker in my index.tsx (React Typescript) like this:
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/service-worker.js')
.then(() => console.log('Worker registered'))
.catch((ex) => console.error('Worker registration error', ex));
}
However, when I start the dev server and go to the app, I get an error:
Failed to register a ServiceWorker for scope ('https://localhost:3000/') with script ('https://localhost:3000/service-worker.js'): An SSL certificate error occurred when fetching the script.
The URL, https://localhost:3000/service-worker.js, does indeed work, the browser is just blocking it because of the self-signed piece of the cert.
I'm using Chrome Browser on on M1 Pro MacBook running MacOS Monterey, with Webpack 5.
For the record, I'm aware of plugins like Workbox, I would prefer not to use them at this time because I'm still very new to Service Workers. I believe in working with the low-level constructs when starting with a new tech to understand them better before embracing easier abstractions.
I'm not aware of any features—including service workers—that require HTTPS on localhost.
localhost, and equivalent IP address ranges, are specifically excluded from HTTPS requirements by Chromium-based browsers, and both Firefox and Safari follow that, at least when it comes to service workers.
So I would suggest that you just access your web site via http://localhost:3000 instead.
There are more details in this older answer.
I trying to setup RestComm Web SDK demo application on my local system, I just want to create an application for audio/video, chat, IVR, etc(RestComm provide me perfect solution for my needs). Now I have setup RestComm Web SDK on my local system and whenever I an trying to sip call, It throws WebRTCommClient:call(): catched exception:NotSupportedError: Failed to construct 'RTCPeerConnection': Unsatisfiable constraint IceTransports on browser console.
My webRTC confrigration is as below:
// setup WebRTClient
wrtcConfiguration = {
communicationMode: WebRTCommClient.prototype.SIP,
sip: {
sipUserAgent: 'TelScale RestComm Web Client 1.0.0 BETA4',
sipRegisterMode: register,
sipOutboundProxy: parameters['registrar'],
sipDomain: parameters['domain'],
sipDisplayName: parameters['username'],
sipUserName: parameters['username'],
sipLogin: parameters['username'],
sipPassword: parameters['password'],
},
RTCPeerConnection: {
iceServers: undefined,
stunServer: 'stun.l.google.com:19302',
turnServer: undefined,
turnLogin: undefined,
turnPassword: undefined,
}
};
While I can use olympus without any issue in Chrome Browser. I am stuck with this exception, any suggestions would be highly appreciated.
I think the problem here is that the version of Webrtcomm library inside the demo application you are using is outdated and doesn't include a fix for latest Chrome version. So please replace samples/hello-world/scripts/WebRTComm.js within your repository, with:
https://github.com/RestComm/webrtcomm/blob/master/build/WebRTComm.js
That should fix your issue.
Best regards,
Antonis Tsakiridis
Recent commits reference TLS progress. Any idea when it will be ready?
If not, what are the options for using SSL with a node app at the present time? Reverse proxy nginx? Is there a good tutorial available for using SSL with node?
Most professional apps need to support SSL these days and it would be great to be able to use node for these now.
Node.js 0.3.4 has been released.
Primordal mingw build (Bert Belder)
HTTPS server
Built in debugger 'node debug script.js'
realpath files during module load (Mihai Călin Bazon)
Rename net.Stream to net.Socket
Fix process.platform
Example
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8000);
Node 3.x is not supposed to be used in production, it's unstable, bleeding edge development. 2.6 still has the old SSL implementation, which works.
If you want to know when all the stuff gets finished, your best bet is to either ask on the Google Group, or Ryan on Twitter.
Just for reference ... here's a JavaScript implementation of SSL/TLS:
https://github.com/digitalbazaar/forge
At the moment, it is only a client-side implementation. It would need to be expanded to cover server-side. For someone with a little knowledge about how TLS works, however, it shouldn't be too difficult to add to the existing framework.
From my experience node 0.2 SSL support is very flacky and unreliable.
We use nginx as a proxy.