Unable to locate credentials from Serverless tutorial

0

I am trying to run the the HelloWorld tutorial at https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-hello-world.html and when I got to the invoke step I get "Error: Unable to locate credentials". I am using identity center and did the sso login. I am not using a default profile since I ultimately will be using more than one. If I run configure list with the profile I get:

aws configure list --profile sls
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                      sls           manual    --profile
access_key     ****************CZ72              sso
secret_key     ****************6wce              sso
    region                us-east-2      config-file    ~/.aws/config

If I do the invoke as it is in the example with the --profile added, it says I have no region information. If I add the --region with us-east2 I get the message about being unable to locate credentials. If I run it with --debug I get:

PS C:\Users\butterba\Documents\Lambdas\sam-helloworld\sam-init-hello\sam-app> sam remote invoke HelloWorldFunction --stack-name sam-app --profile sls --debug --region us-east-2
2023-08-28 16:23:18,777 | Config file location: C:\Users\butterba\Documents\Lambdas\sam-helloworld\sam-init-hello\sam-app\samconfig.toml
2023-08-28 16:23:18,781 | Loading configuration values from [default.['remote', 'invoke'].parameters] (env.command_name.section) in config file at      
'C:\Users\butterba\Documents\Lambdas\sam-helloworld\sam-init-hello\sam-app\samconfig.toml'...
2023-08-28 16:23:18,783 | Configuration values successfully loaded.
2023-08-28 16:23:18,784 | Configuration values are: {'stack_name': 'sam-app'}
2023-08-28 16:23:18,982 | Converting provided --output option value to Enum
2023-08-28 16:23:18,983 | Using config file: samconfig.toml, config environment: default
2023-08-28 16:23:18,985 | Expand command line arguments to:
2023-08-28 16:23:18,986 | --stack_name=sam-app --resource_id=HelloWorldFunction --output=RemoteInvokeOutputFormat.TEXT
2023-08-28 16:23:19,055 | Fetching stack (sam-app) resources
2023-08-28 16:23:19,415 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-08-28 16:23:19,758 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-08-28 16:23:19,759 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '83e42674-c0d1-4ecd-9527-b85fee6730f3', 'installationId':        
'c34ef648-f598-4197-9959-3926b10966dd', 'sessionId': '9991e7ac-2254-4b7e-9cac-d18d18cc68f6', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion':   
'3.8.8', 'samcliVersion': '1.95.0', 'awsProfileProvided': True, 'debugFlagProvided': True, 'region': 'us-east-2', 'commandName': 'sam remote invoke',   
'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin': None, 'projectName': '593ab2ca51e925b9f6c2f258bc55ed5926cf6d2c78239a685d65907e4ec7edd3','initialCommit': None}, 'duration': 431, 'exitReason': 'SDKError', 'exitCode': 1}}]}
2023-08-28 16:23:19,760 | Unable to find Click Context for getting session_id.
2023-08-28 16:23:19,770 | Sending Telemetry: {'metrics': [{'events': {'requestId': 'a07b2c99-c9a4-4f90-bd93-76b95671cf56', 'installationId':
'c34ef648-f598-4197-9959-3926b10966dd', 'sessionId': '9991e7ac-2254-4b7e-9cac-d18d18cc68f6', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion':   
'3.8.8', 'samcliVersion': '1.95.0', 'metricSpecificAttributes': {'events': [{'event_name': 'SamConfigFileExtension', 'event_value': '.toml',
'thread_id': '2f7c6dc7a8fb404b9469a6e96999aa2c', 'time_stamp': '2023-08-28 20:23:18.777', 'exception_name': None}]}}}]}
2023-08-28 16:23:20,820 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read
timeout=0.1)
2023-08-28 16:23:21,157 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read
timeout=0.1)
Error: Unable to locate credentials

Any ideas as to what I am doing wrong?

1 Answer
0

Did you take look at this re:Post Knowledge Center Article, this would help you to compare how you did setup and how it should look like.

Please refer Configuration and credential file settings documentation.

profile pictureAWS
EXPERT
answered 8 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