Hi folks, I'm trying to use `prefect-email` and `e...
# ask-community
m
Hi folks, I'm trying to use
prefect-email
and
email_send_message
but it mostly fails with this message:
Copy code
16:54:09.670 | ERROR   | Task run 'email_send_message-2db' - Crash detected! Execution was cancelled by the runtime environment.
16:54:09.672 | ERROR   | Task run 'email_send_message-2db' - Finished in state Crashed('Execution was cancelled by the runtime environment.')
But when I run it in debugger, line by line, it works however also get this warning message:
Copy code
16:56:10.510 | WARNING | Flow run 'cyber-fennec' - A future was garbage collected before it resolved. Please call `.wait()` or `.result()` on futures to ensure they resolve.
See <https://docs.prefect.io/latest/develop/task-runners> for more details.
Using prefect version
prefect==3.1.1
and prefect-email version
prefect-email==0.4.1
Here's my email function based on Prefect documentation:
Copy code
def send_prefect_email(self, email_server_block: str, recipients: list, subject: str, body: str):
        email_server_credentials = EmailServerCredentials.load(email_server_block)
        email_send_message.submit(
            subject=subject,
            msg=body,
            email_server_credentials=email_server_credentials,
            email_to=recipients
        )
Can someone please advise?
j
If you call .submit() that creates a future that should be awaited somewhere.
upvote 1
thank you 1