Please check below is the screenshot it is having problem. Aws credentials are configured correctly and its working fine when we use separately in boto3 but in SAM lambda function trigger it getting this error.enter image description here
tried with all solutions like checking "aws configure" & unset AWS_SECURITY_TOKEN
& other solutions mentioned in other sources also tried but didn't work.
and In code am trying to do
session = boto3.session.Session()
secretsmanager = session.client('secretsmanager')
try:
get_secret_value_response = secretsmanager.get_secret_value(
SecretId=secret_name
)
secret = json.loads(get_secret_value_response['SecretString'])
except ClientError as e:
print(e)
# print(sys.exc_info(),traceback.print_exc(file=sys.stdout))
except Exception as e:
print(sys.exc_info(),traceback.print_exc(file=sys.stdout))
print(e)