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 Respostas
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
respondido há 2 anos
profile pictureAWS
ESPECIALISTA
avaliado há 2 anos
  • 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
ESPECIALISTA
Uri
respondido há 2 anos
profile pictureAWS
ESPECIALISTA
avaliado há 2 anos
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
ESPECIALISTA
respondido há 2 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas