1

i am trying to make a post call from lambda function but not able to run the code on aws console but it it working properly on my system.

enter image description here

2 Answers 2

2

I had this error today, and this is the first result on Google, so I'll add my answer. In short, I had specified the handler incorrectly on the command line when I uploaded the function.

aws lambda create-function --function-name python-test-lambda --runtime python3.7 --role arn:aws:iam::123123123123:role/service-role/rolearn --handler lambda_function.lambda_handler --zip-file fileb://lambda_function.zip

ie this part was incorrect

--handler

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

Comments

1

You need to install the dependencies in the folder where you have index.py then you need to zip the contents of the folder and upload the zip file to AWS Lambda.

Please note that you need to zip the contents of the folder, do not zip the folder itself.

On windows, you can install the packages in the folder using below command:

pip install package-name -t "/path/to/project-dir"

7 Comments

then why cant we see the packages in the file listing in your screenshot? there should have been a folder named requests among other things
maybe that's the problem. in windows it does not work like that, no idea about MAC.
Your dependancies should be in the same directory as index.py (in the root of the zip). In this case, requests.
@sid8491its working great. i am getting my data i just have one more question how can i put this data to my lex bot.
you need to return with dialogAction with type Close. read more here: docs.aws.amazon.com/lex/latest/dg/…
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.