[BUG] SSL errors when run in mode with node 10.x env
See original GitHub issueEnvironment
chrome-aws-lambda
Version: 2.1.1puppeteer
/puppeteer-core
Version: 2.1.1- OS: Ubuntu 18.04
- Node.js Version: 10.19.0
- Lambda / GCF Runtime: GCF
Expected Behavior
Https page are crawling properly
Current Behavior
Getting ssl errors. This happens both of locally and on CGF. The same script was working well with traditional puppeteer.
Possible Solution
That’s also happening on CGF, not related to my machine
Steps to Reproduce
Take the example from the README:
const chromium = require('chrome-aws-lambda');
const main = async () => {
let result = null;
let browser = null;
try {
browser = await chromium.puppeteer.launch({
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath,
headless: chromium.headless,
});
let page = await browser.newPage();
await page.goto('https://example.com');
result = await page.title();
} finally {
if (browser !== null) {
await browser.close();
}
}
console.log(result);
};
main();
- ✔️ run it with node, without specifying env variables. It works well:
node test.js
- 🚫 run it with node, with env AWS_EXECUTION_ENV. It fails with ssl errors:
AWS_EXECUTION_ENV=AWS_Lambda_nodejs10.x node test.js
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to Resolve Certificate Errors in a NodeJS App with SSL ...
A practical guide to resolving SSL certificate errors ... In a production environment, NodeJs App typically sits behind a reverse proxy like Nginx...
Read more >How to fix SSL certificate error when running Npm on Windows?
So the solution is explicitly set root certificate for https://registry.npmjs.org . We can use openssl to make sure that the reason bellow is...
Read more >SSL error when making fetch() request from Node to Caddy
I run php-based backend API and Remix.js frontend. Both behind Caddy. Caddy routes are as follows: example.com → goes to and gets handled ......
Read more >Node.js Runtime Environment - App Engine - Google Cloud
js version in your package.json file, your deployment will fail with an error message. Dependencies. During deployment, the runtime installs your dependencies ...
Read more >Changelog - Cypress Documentation
Fixed an issue where the Cypress migration wizard would fail to run in global ... Updated the error messaging to provide more context...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@gsouf Apologies for only now properly following up on this, but didn’t manage to find the time before.
After reading your question more closely I realized that you’re actually running on GCP! 😅 The lines you mentioned overlay the new AWS Lambda 2 environment with missing fonts and shared libraries from the Chromium sysroot, but they should only be executed on AWS Lambda, and not GCP.
So simply not setting the
AWS_EXECUTION_ENV
should make your problem go away. 🙂@tnolet The underlying cause is libnss error code 8179:
As you can see the certificate chain is incomplete, if you test with cURL you can see that it also fails:
However https://www.seha.sa/account/login (after the redirect) works fine.
Same thing for the issue reported in #90:
And https://www.incometaxindiaefiling.gov.in/home (before the redirect) works fine.
I don’t understand why rolling back to Node 8 solves the issue for you (and I can no longer spin up Node 8 Lambdas) but it could be that either Node or Chromium are more lax about the certificates (unlikely) or that the provisioned libnss ships with additional certificates in the system CA cert DB (more likely).
Either way, I’d recommend to upgrade and set
ignoreHTTPSErrors: true
in this case.I’m seeing similar behaviour. We are running chrome-lambda 1.19 on Node10x in canary mode on production. For example, this script:
will throw:
Switching back to node 8 fixes it. Also, using
ignoreHTTPSErrors: true
fixes it…but should we really want that?