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