aws / aws/aws-sam-cli

sam logs errors out on named stage

Open
#3,446 4 comments 6 reactions 0 assignees View on GitHub
area/logs maintainer/need-followup type/feature
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Description:
When I attempt to run the command `sam logs --stack-name --include-traces --tail --profile --region us-east-1` against a stack with a named stage name (in this case "v1"), it errors out.

### Steps to reproduce:
Run the command `sam logs --stack-name --include-traces --tail --profile --region us-east-1` after sam syncing an API Gateway with a named stage.

### Observed result:
I get the following error:

```shell
Experimental features are enabled for this session.
Visit the docs page to learn more about the AWS Beta terms https://aws.amazon.com/service-terms/.

Traceback (most recent call last):
File "samcli/__main__.py", line 12, in
File "click/core.py", line 829, in __call__
File "click/core.py", line 782, in main
File "click/core.py", line 1259, in invoke
File "click/core.py", line 1066, in invoke
File "click/core.py", line 610, in invoke
File "click/decorators.py", line 73, in new_func
File "click/core.py", line 610, in invoke
File "samcli/lib/telemetry/metric.py", line 157, in wrapped
File "samcli/lib/telemetry/metric.py", line 122, in wrapped
File "samcli/lib/utils/version_checker.py", line 41, in wrapped
File "samcli/cli/main.py", line 87, in wrapper
File "samcli/commands/_utils/experimental.py", line 198, in wrapped_func
File "samcli/commands/_utils/experimental.py", line 198, in wrapped_func
File "samcli/commands/_utils/experimental.py", line 198, in wrapped_func
File "samcli/commands/logs/command.py", line 120, in cli
File "samcli/commands/logs/command.py", line 171, in do_cli
File "samcli/commands/logs/puller_factory.py", line 84, in generate_puller
File "samcli/lib/observability/cw_logs/cw_log_group_provider.py", line 32, in for_resource
File "samcli/commands/_utils/experimental.py", line 176, in wrapped_func
File "samcli/lib/observability/cw_logs/cw_log_group_provider.py", line 104, in for_apigwv2_http_api
File "botocore/client.py", line 388, in _api_call
File "botocore/client.py", line 708, in _make_api_call
botocore.errorfactory.NotFoundException: An error occurred (NotFoundException) when calling the GetStage operation: Invalid stage identifier specified
```

I'm guessing that stage is not supported yet. Is there a workaround?

### Expected result:
My sam logs connects and gives me near real-time log output.

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

1. OS: Windows 11
2. `sam --version`: 1.35.0
3. AWS region: us-east-1

`Add --debug flag to command you are running`

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.