DynamoDB is not responding to lambda

0

The dynamodb is getting connected and the data is also stored via console, but while doing CRUD operations in lambda there is no response sent and the code exits with 1. I have tried changing boto3 versions as well but there is no error thrown nor is the response coming.

Can someone please help us sort this?

3 個答案
2

Since you said you are able to save to data to dynamodb there might not be an issue while saving, You can try to add your whole lambda code in try-except block and catch the exception and maybe add some traceback that will give you more idea of what error your logic gotten

def lambda_handler(event, context):
	try:
		# your awsm logic
		resp = save_to_db()
		helper()
	except Exception as e:
		logger.exception(e)
		

Hope that will help else you can put your code snippet error snapshots, cheers!

Khushal
已回答 2 年前
profile pictureAWS
專家
已審閱 2 年前
  • I have the same problem, and neither the except block nor the finally get triggered. I obtain a boto3.session --> (session.resource) db --> table but when I call scan() on the table it stalls and I never re-enter the code. The function times out, the container is not created, and I get 'No response from invoke container for <function name>' and an invalid lambda response, invalid json -- because I never re-enter my code to format the response.

1

Another option is if you attached the Lambda function to a VPC, you need to create a DynamoDB endpoint in that VPC so that the function can access it.

profile pictureAWS
專家
Uri
已回答 2 年前
profile pictureAWS
專家
已審閱 2 年前
0

Have you ensured that the Lambda function role has the right policies to access DynamoDB. Here is a blog that you can take a look at - https://aws.amazon.com/blogs/security/how-to-create-an-aws-iam-policy-to-grant-aws-lambda-access-to-an-amazon-dynamodb-table/

Also look at this document - https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_lambda-access-dynamodb.html

Once you ensure that and if it still fails, then please follow Khushal's recommendation.

profile pictureAWS
專家
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南