Closed knownasilya closed 6 years ago
The error responding should definitely be improved. This is what the logs are showing:
Oct 06 06:52:59 url-to-pdf-api app/web.1: 2017-10-06T13:52:58.874Z - info: [pdf-core.js] Rendering with opts: {
Oct 06 06:52:59 url-to-pdf-api app/web.1: "scrollPage": false,
Oct 06 06:52:59 url-to-pdf-api app/web.1: "emulateScreenMedia": true,
Oct 06 06:52:59 url-to-pdf-api app/web.1: "viewport": {
Oct 06 06:52:59 url-to-pdf-api app/web.1: "width": 1600,
Oct 06 06:52:59 url-to-pdf-api app/web.1: "height": 1200
Oct 06 06:52:59 url-to-pdf-api app/web.1: },
Oct 06 06:52:59 url-to-pdf-api app/web.1: "goto": {
Oct 06 06:52:59 url-to-pdf-api app/web.1: "waitUntil": "networkidle",
Oct 06 06:52:59 url-to-pdf-api app/web.1: "networkIdleTimeout": 2000
Oct 06 06:52:59 url-to-pdf-api app/web.1: },
Oct 06 06:52:59 url-to-pdf-api app/web.1: "pdf": {
Oct 06 06:52:59 url-to-pdf-api app/web.1: "format": "A4",
Oct 06 06:52:59 url-to-pdf-api app/web.1: "printBackground": true,
Oct 06 06:52:59 url-to-pdf-api app/web.1: "margin": {}
Oct 06 06:52:59 url-to-pdf-api app/web.1: },
Oct 06 06:52:59 url-to-pdf-api app/web.1: "url": "https://drivetexas.org/"
Oct 06 06:52:59 url-to-pdf-api app/web.1: }
Oct 06 06:52:59 url-to-pdf-api app/web.1: 2017-10-06T13:52:59.335Z - info: [pdf-core.js] Set browser viewport..
Oct 06 06:52:59 url-to-pdf-api app/web.1: 2017-10-06T13:52:59.339Z - info: [pdf-core.js] Emulate @media screen..
Oct 06 06:52:59 url-to-pdf-api app/web.1: 2017-10-06T13:52:59.340Z - info: [pdf-core.js] Goto url https://drivetexas.org/ ..
2017-10-06T13:52:59.458Z - error: [pdf-core.js] Error when rendering page: Error: SSL Certificate error: ERR_CERT_AUTHORITY_INVALID
Oct 06 06:52:59 url-to-pdf-api app/web.1: 2017-10-06T13:52:59.458Z - error: [pdf-core.js] Error: SSL Certificate error: ERR_CERT_AUTHORITY_INVALID
Oct 06 06:52:59 url-to-pdf-api app/web.1: at NavigatorWatcher.waitForNavigation (/app/node_modules/puppeteer/lib/NavigatorWatcher.js:73:20)
Oct 06 06:52:59 url-to-pdf-api app/web.1: at <anonymous>
Oct 06 06:52:59 url-to-pdf-api app/web.1: at process._tickCallback (internal/process/next_tick.js:188:7)
Oct 06 06:52:59 url-to-pdf-api app/web.1: 2017-10-06T13:52:59.458Z - info: [pdf-core.js] Closing browser..
Sounds like a potentially outdated version of openssl is being used? cc @calvinmetcalf
I can’t check right know but Puppeteer repository issues may have additional info about this
Maybe ignoreHTTPSErrors
needs to be set for puppeter.
That sounds like a better default setting from usage perspective. I wonder if it has any security issues we should take into account.
I'd make it a query param flag that can toggle ignoring SSL, and add a better error message if not enabled.
ignoreHttpsErrors
option now in master.
The following url returns a 500 error, with no useful details.
https://url-to-pdf-api.herokuapp.com/api/render?url=https://drivetexas.org/#/7/32.340/-99.500?future%3Dfalse%26print%3Dtrue