security exception on lambda function

0

When i'm testing my lambda function i get this error

"body": "{\"error\":{\"root_cause\":[{\"type\":\"security_exception\",\"reason\":\"no permissions for [indices:data/read/search] and User [name=arn:aws:iam::xxxxxx:role/service-role/testFunction-role-etjiy0ib

But if i go to IAM dashboard and go to the testFunction-role-etjiy0ib, this role has all this permissions: Enter image description here

What am i doing wrong?

2 Answers
0
Accepted Answer

Hi, I recommend you redact all endpoints from the code and screenshots.

I see you already asked the same question here: https://repost.aws/questions/QULkoc-0AkQ1yDgN0ANxE7lg/lambda-function-error-list-indices-must-be-integers-or-slices-not-str Have you tried the recommendations and managed to get the print to show? Do you have a stack trace that indicates where its failing?

It seems you are not passing a JSON object to the function using the Test method but rather a list of objects. Could you please check that?

I also recommend you go through a workshop like this: https://aws.amazon.com/getting-started/hands-on/run-serverless-code/ to learn more about Lambda.

Hope it helps Jon

profile pictureAWS
EXPERT
answered a year ago
0

I'm facing the same error (security exception). Were you able to resolve this?

Kumuda
answered 4 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions