aws / aws/aws-sam-cli

local start-api fails with expired SSO token

Open
#6,012 2 comments 0 reactions 0 assignees View on GitHub
area/local/start-api
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Description:
running ```sam local start-api``` fails with error wihtout sso token (not logged into aws)

`
Lambda functions containers initialization failed because of Error when retrieving token from sso: Token has expired and refresh failed
Error: Lambda functions containers initialization failed
`

### Steps to reproduce:

1. aws is configured to use sso (not default)
2. sso token is not available or is expired
3. start local lambda

### Observed result:

`
Lambda functions containers initialization failed because of Error when retrieving token from sso: Token has expired and refresh failed
Error: Lambda functions containers initialization failed
`

### Expected result:

Running lambda locally shouldn't require (or fail) without an active/valid sso session with aws.

### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

1. OS: Windows 11
4. `sam --version`: SAM CLI, version 1.97.0
5. AWS region: N/A
```
{
"version": "1.97.0",
"system": {
"python": "3.8.8",
"os": "Windows-10-10.0.22000-SP0"
},
"additional_dependencies": {
"docker_engine": "24.0.2",
"aws_cdk": "Not available",
"terraform": "1.5.3"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
```

`
Loading AWS credentials from session with profile 'None'
2023-09-29 11:17:38,182 | Exception raised during the execution
2023-09-29 11:17:38,183 | Lambda functions containers initialization failed because of Error loading SSO Token: Token for AWS-DEV
does not exist
`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.