scraping_paint
scraping_paint

Reputation: 71

I need help resolving a Runtime.ImportModuleError in AWS Lambda

I am new to AWS Lambda, and I am trying to run a simple print('hello') statement in a test scenario of a Lambda function written in Python. However, I keep getting a Runtime.ImportModuleError. Here is my code:

import boto3

def handler(event, context):
    s3 = boto3.client('s3')
    csvfile = s3.get_object(Bucket='mybucket', Key='fname.csv')
    print('hello')

Here is the name of my function:

enter image description here

And here are my Runtime settings:

enter image description here

My test event is configured as:

{
  "key1": "value1",
  "key2": "value2",
  "key3": "value3"
}

When I hit the 'Test' button, however, I get this error message:

Response
{
  "errorMessage": "Unable to import module 'dts_scrape': No module named 'dts_scrape'",
  "errorType": "Runtime.ImportModuleError"
}

Does anyone know what is going on here?

Upvotes: 0

Views: 231

Answers (1)

scraping_paint
scraping_paint

Reputation: 71

I figured it out...I hadn't hit "Deploy Changes" with the correct handler name. Doing so resolved the error.

Upvotes: 1

Related Questions