I am dealing with ERPNext for a couple of months now and we are starting to transfer one process after another into it. It is simply overwhelming what an open source solution is capable of!
My ERPNext instance is hosted locally here on a server in our office and is made available on the internet using a port forwarding on port 443. That works fine so far.
However, since I got the SSL working, my PDFs are looking messed up. The HTML preview looks fine, but printing it to PDF does not seem to pay attention to the print styles. Logo is missing, tables are missing lines etc.
My research lead me to dozens of threads where the solution was simply adding the domain like erp.example.com to the site_config.json. Unfortunately that does not work for me. I tried to dug as deep as I can and found out that this issue might be related to socketio not working. So, I checked the proper logs and found the following:
frappe@erpnextprod:~/frappe-bench$ tail -f logs/node-socketio.log
No response for doc_subscribe
listening on *: 9000
Unable to join chat room. Error: self signed certificate
Unable to join chat room. Error: self signed certificate
No response for doc_subscribe
No response for doc_subscribe
listening on *: 9000
Unable to join chat room. Error: self signed certificate
No response for doc_subscribe
No response for doc_subscribe
I don’t know how to get on to be honest. Printing and sending PDF files via mail is crucial thing to do. So, any help in troubleshooting is very welcome! Thanks in advance.
PS: I am not quite sure if this is the correct category since it refers to some other topics as well…
I could not point you to the exact thread right now, but I remember reading a post on the forum that linked me to a github posting of similar problems.
Ultimately is was determined that the host machine did not have enough memory and that was somehow affecting the cached script files that actually perform the conversion to PDF.
On KVM type VPS applications they consensus was that a minimum of 4gb of system memory was required to start seeing improvement in the PDF rendering. This also means there would be 2gb or more of swap memory (over and above the system memory) to aid in the check pointing processes that were possibly causing the problems with the PDF rendering engine.
I know it was an interesting rabbit hole to read through but it made sense and they folks that were experiencing the problems had them solved by dramatically increasing the system memory.
If you want to experiment with this concept, you could get one of the free tiral accounts on Google Cloud, spin up a low memory server maybe 2gb or so, and then a higher memory server of 6 or 8gb to see if the problem does in fact go away with the addition of memory. It is cretainly cheaper than tearing apart your metal box server to add the hardware and it only takes a few min to do this on GCP.
Or - Maybe you can find some search terms in my paraphrasing above that would help you find the same rabbit hole of reading that I ran into last week.
Hope you find a solution soon. Please post back when you do.
Thanks for your input.
As I said I am running ERPNext on a virtual machine here in my office. The server has 32GB memory, the VM is having 16GB available. I am quite sure this is not the problem…
The key question for me is: Why does socketio stop to work after adding SSL encryption. Fortunately, I have a snapshot from before and was double-checking. Before adding SSL, the log just didn’t show anything.
Now, after adding SSL it shows the following:
frappe@erpnextprod:~$ tail -f frappe-bench/logs/node-socketio.log
Unable to join chat room. Error: self signed certificate
No response for doc_subscribe
listening on *: 9000
Unable to join chat room. Error: self signed certificate
Unable to join chat room. Error: self signed certificate
No response for doc_subscribe
No response for doc_subscribe
listening on *: 9000
Unable to join chat room. Error: self signed certificate
Unable to join chat room. Error: self signed certificate
Unable to join chat room. Error: self signed certificate
No response for doc_subscribe
No response for doc_subscribe
Is there any way to dig some deeper? Any more logs I could look into? Any hints are welcome as I am starting to loose my head…
To the hosts file I had to add 127.0.0.1 mydomain.com
Afterwards do a bench setup nginx sudo service nginx restart
and finally a bench restart
Now my site is securely(!) available on the internet with working PDF files.
Perhaps you added the entry to your local machine and not your server?
Thank you to @Sven_Morgenstern I added the entry to my host file and all is well now!
I spent so much time on this issue because I thought it was because I was using SSL and
had an additional Nginx server acting as a reverse proxy in front of Frappe.
I can’t believe such a simple solution was found after days of troubleshooting!