Skip to content

SAM 0.17+ prompts for MFA credentials on every request when running API locally #1375

@johnc44

Description

@johnc44

Description

We use Multi-Factor Authentication to access our AWS accounts.

In previous versions (0.19.0), SAM CLI would prompt for my MFA token when I first invoked the lambda, and would then retain those credentials for future requests. Eventually they would expire and I'd have to quit/restart to get it to work again, but it was quite workable.

In 0.20.1, however, I am asked for my MFA credentials on literally every request. This makes it completely unusable for me, so I've had to downgrade again.

Steps to reproduce

Using Ubuntu WSL:

export AWS_PROFILE=
aws local start-api -n environment.json -p 3100

Then hit the API. It sits there twiddling its thumbs. Switch back to Ubuntu and it's asking for the MFA code. Enter it in, everything works.

Hit the API a second time. Again, it sits there thinking about it. Switch back to Ubuntu and it's asking for the MFA again. This is not the case in 0.19.0 which would remember my token.

Observed result

Asked for MFA code on every single request.

Expected result

MFA token should be cached between requests.

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

  1. OS: Windows 10, patched up to date. Using Ubuntu WSL.
  2. sam --version: 0.20.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions