Hello, I am getting wkhtmltopdf HostNotFoundError’s when sending documents by email with Send Document Print selected. If I recall correctly, I believe it also happens with a new user “complete registration” email. Has anyone seen this in v10 and has a solution?
I am encountering this on two servers since upgrading erpnext on them to v10 - at least anecdotally. I started with one pre-v10 server and could send a document by email (such as an item master) with “Send Document Print” selected and there was no trouble. Then I upgraded erpnext on the vm to v10 and moved the vm to a new box, which is when I noticed the problem. I subsequently found the original vm also has wkhtmltopdf failures when sending a document by email with “Send Document Print” selected. If “Send Document Print” is not selected, the email is sent (and received) with no trouble.
I would appreciate any suggestions how to troubleshoot this.
wkhtmltopdf reported an error:
Exit with code 1 due to network error: HostNotFoundError
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/queue.py", line 418, in send_one
message = prepare_message(email, recipient.recipient, recipients_list)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/queue.py", line 535, in prepare_message
print_format_file = frappe.attach_print(**attachment)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1266, in attach_print
"fcontent": get_print(doctype, name, print_format=print_format, style=style, html=html, as_pdf=True, doc=doc)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1249, in get_print
return get_pdf(html, output = output)
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/pdf.py", line 17, in get_pdf
pdfkit.from_string(html, fname, options=options or {})
File "/home/frappe/frappe-bench/env/src/pdfkit/pdfkit/api.py", line 68, in from_string
return r.to_pdf(output_path)
File "/home/frappe/frappe-bench/env/src/pdfkit/pdfkit/pdfkit.py", line 140, in to_pdf
raise IOError('wkhtmltopdf reported an error:\n' + stderr.decode('utf-8'))
IOError: wkhtmltopdf reported an error:
Exit with code 1 due to network error: HostNotFoundError
Both servers use the virtual image ("built on October 10, 2017), hosted using VirtualBox. The first vm is NAT’d onto the internet by the VirtualBox router and port 80 is forwarded to port 8080 (to not conflict with an existing web server on the host). The second server is on a host behind a NAT router/firewall. It uses VirtualBox bridged networking, and is configured in the DMZ of the firewall - appearing to the internet as the WAN-side IP address of the router.
Both vm’s were updated to v10 a couple days after it was released, but otherwise the base system has been left as-is.
frappe@erpnext:~/frappe-bench$ bench version
erpnext 10.0.4
frappe 10.0.5
frappe@erpnext:~/frappe-bench$
I’ve been manually sending one of the item documents to an outside email address, and if Send Document Print is selected when the email is sent, the SendGrid control panel shows no email is received. In ERPNext, eventually the activity trail for the item shows that there was an error sending the email and an error log is created (Explore > Setup > Error logs).
Thanks,
Dale