-
Notifications
You must be signed in to change notification settings - Fork 743
Closed
Labels
environment-variablesfeature-requestNew feature or enhancement. May require GitHub community feedback.New feature or enhancement. May require GitHub community feedback.samtechnical-debt
Description
Describe the bug
SAM invoke calls (via "Run Locally" and "Debug Locally") will fail if a user does not have a [default] entry in their ~/.aws/config file containing a region value.
To Reproduce
- Delete/rename/move your
~/.aws/configfile - Attempt a local run/debug of a Lambda function (all runtimes affected)
Expected behavior
Function runs with a user-defined region tied to the SAM environment (so the AWS_REGION variable will work)
Desktop (please complete the following information):
- OS: All
- Visual Studio Code Version: All
- AWS Toolkit for Visual Studio Code Version: All
Additional context
We have a few implementation options:
- Set the
AWS_REGIONenv var with a valid region code - Pass the
--regionflag to the SAM CLI invoke call with a valid region code. - Pass the
--profileflag to the SAM CLI invoke call with the selected AWS profile name. This requires that an~/.aws/configis created at some point (we don't do this) that has a[profile <profileName>]entry containing aregionvalue
JetBrains sets the AWS_REGION but uses the selected AWS region for the workspace (since they don't have a concept of multiple regions in the explorer).
Aside from pulling the value from ~/.aws/config, we can:
- Pull the first region from the AWS explorer
- Have the AWS explorer only list one region at a time? That way, we always pull the region in question.
- Pulling the first region is blocked due to Selected regions in AWS Explorer pane do not persist order after restarting IDE #421
- Add region value to our template.json file
- Prompt the user on run/debug for a region
- We can cache this value for later
- Use a hardcoded value (this breaks users who are testing the
AWS_REGIONvariable)
Metadata
Metadata
Assignees
Labels
environment-variablesfeature-requestNew feature or enhancement. May require GitHub community feedback.New feature or enhancement. May require GitHub community feedback.samtechnical-debt