Hi all, I’d like to list a possible bug here.
What I’m trying to do:
- generate PDF attachments and send an email by a scheduled task
What I’ve tried and what’s not working:
The PDF generation code that I am using functions properly if it is invoked by an @anvil.server.callable that uses anvil.server.launch_background_task(). However, if I attempt to use the same @anvil.server.background_task directly in the task scheduling service, the task is invoked but the below error is returned. Again, the same code works fine when called without the scheduling service and breaks when used with the scheduling service.
Code Sample:
This is simplified and it works:
@anvil.server.callable
def send_pdf_email():
task = anvil.server.launch_background_task('send_pdf_email_task')
return task
@anvil.server.background_task
def send_pdf_email_task():
pdf1 = anvil.pdf.PDFRenderer( .... )
The same send_pdf_email_task() breaks with the following error when scheduled with the task scheduling service. No changes in the above code that otherwise functions as expected.
Error:
AnvilWrappedError: Internal server error: 56cba5505755at
/downlink/anvil/pdf.py, line 17
called from /downlink/anvil/pdf.py, line 43
Thank you.