OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

An error occurred (UnrecognizedClientException) when calling the GetSecretValue operation: The security token included in the request is invalid

  • Thread starter Thread starter Vijaya Teja M
  • Start date Start date
V

Vijaya Teja M

Guest
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

Code:
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)
<p>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.<a href="https://i.sstatic.net/9kk3C.png" rel="noreferrer">enter image description here</a></p>
<p>tried with all solutions like checking "aws configure" & unset <code>AWS_SECURITY_TOKEN</code> & other solutions mentioned in other sources also tried but didn't work.</p>
<p>and In code am trying to do</p>
<pre><code>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)
</code></pre>
 

Latest posts

A
Replies
0
Views
1
Ashrik Ahamed
A
A
Replies
0
Views
1
Ashrik Ahamed
A

Online statistics

Members online
1
Guests online
3
Total visitors
4
Top