0

I am trying to run Python Selenium with lambda layers.

I have followed this GitHub page: https://github.com/alvaroseparovich/AWS-LAMBDA-LAYER-Selenium

First, I have uploaded the zip as lambda layer and then created a function as:

import starter as st

def lambda_handler(event, context):
    driver = st.start_drive()
    driver.get('https://www.google.com.br')
    page_data = driver.page_source
    driver.close()
    return page_data

but, it's returning the error as:

Unable to import module 'lambda_function': No module named 'starter'

How can I determine the cause of it?

halfer
  • 19,824
  • 17
  • 99
  • 186
Deependra Dangal
  • 1,145
  • 1
  • 13
  • 36
  • possible duplicate of https://stackoverflow.com/questions/57688731/unable-to-import-module-lambda-function-no-module-named-pandas – cruisepandey Aug 13 '21 at 09:39
  • Note that we prefer a technical style of writing here. We gently discourage greetings, hope-you-can-helps, thanks, advance thanks, notes of appreciation, regards, kind regards, signatures, please-can-you-helps, chatty material and abbreviated txtspk, pleading, how long you've been stuck, voting advice, meta commentary, etc. Just explain your problem, and show what you've tried, what you expected, and what actually happened. – halfer Aug 25 '21 at 07:37

1 Answers1

0

you can package your program with all the dependencies and make a zip file and upload it to lamda.

Try below, https://docs.aws.amazon.com/lambda/latest/dg/python-package.html

Amith Jayasekara
  • 421
  • 1
  • 4
  • 11