0

I've written a lambda function in the AWS Lambda GUI. The program I've written will send me an email, the program appears to work but there is error in my logs and I cannot even begin to understand those errors. I like to seek help on how to resolve the error.

This is the error I've gotten:

{ "errorMessage": "2020-04-27T07:22:08.185Z b6ec9468-75c2-4e39-aeeb-bd0085758fb8 Task timed out after 3.00 seconds" } 

This is the log output

START RequestId: b6ec9468-75c2-4e39-aeeb-bd0085758fb8 Version: $LATEST END RequestId: b6ec9468-75c2-4e39-aeeb-bd0085758fb8 REPORT RequestId: b6ec9468-75c2-4e39-aeeb-bd0085758fb8 Duration: 3003.16 ms Billed Duration: 3000 ms Memory Size: 128 MB Max Memory Used: 50 MB Init Duration: 122.21 ms 2020-04-27T07:22:08.185Z b6ec9468-75c2-4e39-aeeb-bd0085758fb8 Task timed out after 3.00 seconds 

And my code is below (mail-demo.py)

import os import smtplib def main(event, context): # TODO implement EMAIL_ADDRESS = os.environ['EMAIL_ADD'] EMAIL_PASSWORD = os.environ['EMAIL_PWD'] with smtplib.SMTP('smtp.gmail.com', 587) as smtp: smtp.ehlo() smtp.starttls() smtp.ehlo() smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD) subject = 'Wassup!' body = 'Testing some lambda function at don\'t know what time' msg = f'Subject: {subject}\n\n{body}' smtp.sendmail(EMAIL_ADDRESS, EMAIL_ADDRESS, msg) return 'email sent success' 

1 Answer 1

1

You have to increase your functions execution timeout:

Timeout – The amount of time that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.