Hello, community!
I’m encountering an issue while trying to send an email through a Gmail account. The process fails with the error shown below. It seems related to generating a PDF, possibly due to broken image links or network restrictions. Has anyone faced a similar problem or know how to resolve this?
frappe@180992f368c6:~/frappe-bench$ bench version
ecommerce_integrations 1.17.0
erpnext 15.38.1
frappe 15.44.1
hrms 15.31.0
payments 0.0.1
print_designer 1.4.3
webshop 0.0.1
wkhtmltopdf --version
wkhtmltopdf 0.12.6.1 (with patched qt)
Error Details:
Traceback (most recent call last):
File "apps/frappe/frappe/utils/pdf.py", line 90, in get_pdf
filedata = pdfkit.from_string(html, options=options or {}, verbose=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pdfkit/api.py", line 75, in from_string
return r.to_pdf(output_path)
^^^^^^^^^^^^^^^^^^^^^
File "env/lib/python3.11/site-packages/pdfkit/pdfkit.py", line 201, in to_pdf
self.handle_error(exit_code, stderr)
File "env/lib/python3.11/site-packages/pdfkit/pdfkit.py", line 155, in handle_error
raise IOError('wkhtmltopdf reported an error:\n' + stderr)
OSError: wkhtmltopdf reported an error:
Exit with code 1 due to network error: ContentOperationNotPermittedError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 167, in send
message = ctx.build_message(recipient.recipient)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 315, in build_message
message = self.include_attachments(message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 392, in include_attachments
print_format_file = frappe.attach_print(**attachment)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/__init__.py", line 2232, in attach_print
else get_print(doctype, name, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/__init__.py", line 2191, in get_print
return get_pdf(html, options=pdf_options, output=output) if as_pdf else html
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/utils/pdf.py", line 98, in get_pdf
frappe.throw(_("PDF generation failed because of broken image links"))
File "apps/frappe/frappe/__init__.py", line 652, in throw
msgprint(
File "apps/frappe/frappe/__init__.py", line 617, in msgprint
_raise_exception()
File "apps/frappe/frappe/__init__.py", line 568, in _raise_exception
raise exc
frappe.exceptions.ValidationError: PDF generation failed because of broken image links
During handling of this error, a ValidationError
is raised:
frappe.exceptions.ValidationError: PDF generation failed because of broken image links
It looks like the PDF generation might be failing due to inaccessible image URLs. If anyone has suggestions or a solution for this issue, I’d greatly appreciate your help!
Thank you in advance!