Laravel-snappy: SSL resources not loading

Created on 21 Jul 2017  路  29Comments  路  Source: barryvdh/laravel-snappy

I am trying to load a view which generates charts and bars using google charts library, because the chart library is hosted on google server with an SSL, I get the following error :

(1/1) RuntimeException

The exit status code '1' says something went wrong:
stderr: "Loading pages (1/6)
[> ] 0%
[======> ] 10%
QSslSocket: cannot resolve CRYPTO_num_locks
QSslSocket: cannot resolve CRYPTO_set_id_callback
QSslSocket: cannot resolve CRYPTO_set_locking_callback
QSslSocket: cannot resolve sk_free
QSslSocket: cannot resolve sk_num
QSslSocket: cannot resolve sk_pop_free
QSslSocket: cannot resolve sk_value
QSslSocket: cannot resolve SSL_library_init
QSslSocket: cannot resolve SSL_load_error_strings
QSslSocket: cannot resolve SSLv3_client_method
QSslSocket: cannot resolve SSLv23_client_method
QSslSocket: cannot resolve SSLv3_server_method
QSslSocket: cannot resolve SSLv23_server_method
QSslSocket: cannot resolve X509_STORE_CTX_get_chain
QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
QSslSocket: cannot resolve SSLeay
QSslSocket: cannot call unresolved function CRYPTO_num_locks
QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function sk_num
[===============> ] 25%
[=====================> ] 36%
[=========================> ] 43%
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
Warning: Failed to load https://www.gstatic.com/charts/45.2/loader.js (ignore)
[============================================================] 100%
Counting pages (2/6)
[============================================================] Object 1 of 1
Resolving links (4/6)
[============================================================] Object 1 of 1
Loading headers and footers (5/6)
Printing pages (6/6)
[> ] Preparing
[===================> ] Page 1 of 3
[=======================================> ] Page 2 of 3
[============================================================] Page 3 of 3
Done
Exit with code 1 due to network error: ContentNotFoundError
QSslSocket: cannot call unresolved function CRYPTO_num_locks
QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
"
stdout: ""
command: /usr/local/bin/wkhtmltopdf-amd64 --lowquality '/tmp/knp_snappy59719aad573823.86128540.html' '/tmp/knp_snappy59719aad573c74.43593591.pdf'.

Just so you know, following is my code which I have tried

//return view('pdf.reports', compact('merged', 'request', 'marketplaces', 'brands', 'title', 'type'));
        //$pdf = App::make('snappy.pdf');
        return SnappyPdf::loadView('pdf.reports', ['merged' => $merged, 'request' => $request, 'marketplaces' => $marketplaces, 'brands' => $brands, 'title' => $title, 'type' => $title])->inline('page.pdf');
        //$pdf = SnappyPdf::loadView('pdf.reports', compact('merged', 'request', 'marketplaces', 'brands', 'title', 'type'));
        //return $pdf->download();

and the error is because of SSL is my wild guess, I just tried to load a simple view which also didnt work

Most helpful comment

I found a solution that works. checkout @Kaicastledine's solution on this thread

Summary

Downgrade libssl
apt install libssl-dev=1.0.2g-1ubuntu4.8

Lock it from future upgrades
apt-mark hold libssl-dev

All 29 comments

@khanof89 I'm facing the same issue, please let me know if you find any solution for this.

@siddharthghedia no solutions so far, google charts doesn't work locally and it is their TOS also that you cannot use it locally, and wkhtmltopdf doesn't handle ssl properly

@khanof89 I guess problem is not with SSL, I just tried removing the SSL, and is still showing the same error :(

@siddharthghedia een if you remove https from the first url i.e https://www.gstatic.com/charts/45.2/loader.js the other scripts called by loader.js are still on ssl, gogole charts doesn't work without ssl

@khanof89 ssl is the problem yeah :D :D , was working when removed ssl, when added back, its not working :(

I found a solution that works. checkout @Kaicastledine's solution on this thread

Summary

Downgrade libssl
apt install libssl-dev=1.0.2g-1ubuntu4.8

Lock it from future upgrades
apt-mark hold libssl-dev

@nonsocode Thanks very much!!!

The downgrade libs change, right now it's 4.10 not 4.8, look here for the current version for you.
https://packages.ubuntu.com/xenial/libssl1.0.0

For Ubuntu 17.10:

apt install libssl-dev=1.0.2g-1ubuntu13.3

On Ubuntu 17.10 I used the following package to fix this issue.

apt-get install libssl1.0-dev

For Ubuntu 18.04, any idea ? :-)

14.04 = apt install libssl-dev=1.0.1f-1ubuntu2.25 (Tested and worked)
18.04 = apt install libssl-dev=1.0.2n-1ubuntu5 (Not tested) @bluemountainteam

@vnetmx
Tried in Ubuntu 18.04 Linux AMI (AWS)

sudo apt install libssl-dev=1.0.2n-1ubuntu5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '1.0.2n-1ubuntu5' for 'libssl-dev' was not found

But I tried to just sudo apt install libssl1.0-dev and I got it working, but it uninstalled php7.2-dev. =(

@icaroscherma

Try this:
sudo apt install libssl1.0-dev=1.0.2n-1ubuntu5

@vnetmx

sudo apt install libssl1.0-dev=1.0.2n-1ubuntu5

Works on Ubuntu 18.04. Thx a lot!

Yeah but I'm not sure that is the best way, as you're actually downgrading lib ssl, right?

@icaroscherma Thanks! sudo apt install libssl1.0-dev worked like a charm!

@barryvdh I think we are only installing Development Files, not downgrading lib. But this is only a workaround, maybe we need a fix to work with newer versions.

Hi @barryvdh , I understand its not a problem of you're package, but a problem with new versions of Ubuntu, anyway as you can see here https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3001#issuecomment-396815585 the issue was resolved (much better than downgrading) , but the composer package maintainer hasn't updated to the new version (0.12.5), is there any way to use another package or fork?

Appreciate any help

See https://github.com/h4cc/wkhtmltopdf-amd64/issues/31
You are free to fork or install it yourself, I don't maintain wkhtmltopdf of the composer binaries.

But glad it's solved with the latest version :)

Ubuntu 18.04.1:

sudo apt-get install libssl1.0-dev

https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3001

Upgdaring wkhtmltopdf to 0.12.5 solve SSL problem.

I have the same issue. Using Ubuntu 18.04. I installed wkhtmltopdf to 0.12.5 and still have the same issues.

What is a safe way to fix this, without downgrading SSL libs?

In my case I fixed it by not using https when rendering in snappy... like

{{ request()->boolean('use_snappy') ? 'http' : 'https' }}://some-url.com/assets/style.css

update wkhtmltopdf to version 0.12.6 fixed this error

update wkhtmltopdf to version 0.12.6 fixed this error

This version doesn't exist? 0.12.4 is the latest -> https://github.com/h4cc/wkhtmltopdf-amd64/tags

Not as composer package; https://github.com/h4cc/wkhtmltopdf-amd64/pull/44
I suggest you download the binary directly: https://wkhtmltopdf.org/downloads.html

Forge recipe to install:

echo ">> Installing WkhtmltoPDF 0.12.6"
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
sudo dpkg -i wkhtmltox_0.12.6-1.focal_amd64.deb
sudo apt-get --yes -f install
sudo cp /usr/local/bin/wkhtmlto* /usr/bin/

Thanks @barryvdh, this worked for me! I added wkhtmltopdf as dependency to my docker configuration and pointed theWKHTMLTOPDF_PATH value to it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MitchellBouwman picture MitchellBouwman  路  5Comments

vitorarjol picture vitorarjol  路  4Comments

jerearaujo03 picture jerearaujo03  路  5Comments

vitorf7 picture vitorf7  路  6Comments

MaximeDawn picture MaximeDawn  路  3Comments