aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.51k stars 1.17k forks source link

Bug: sam pipeline init - ResourceNotFoundException #7330

Open kwtsangaf opened 1 month ago

kwtsangaf commented 1 month ago

Description:

throw out Error: An error occurred (ResourceNotFoundException) when calling the GetSecretValue operation: Secrets Manager can't find the specified secret. when running sam pipeline init --bootstrap

Steps to reproduce:

run sam pipeline init --bootstrap image image

Observed result:

Error: An error occurred (ResourceNotFoundException) when calling the GetSecretValue operation: Secrets Manager can't find the specified secret.
Traceback:
  File "click/core.py", line 1078, in main
  File "click/core.py", line 1688, in invoke
  File "click/core.py", line 1688, in invoke
  File "click/core.py", line 1434, in invoke
  File "click/core.py", line 783, in invoke
  File "samcli/cli/cli_config_file.py", line 347, in wrapper
  File "click/decorators.py", line 92, in new_func
  File "click/core.py", line 783, in invoke
  File "samcli/lib/telemetry/metric.py", line 185, in wrapped
  File "samcli/lib/telemetry/metric.py", line 150, in wrapped
  File "samcli/commands/_utils/command_exception_handler.py", line 89, in wrapper_command_exception_handler
  File "samcli/commands/_utils/command_exception_handler.py", line 69, in wrapper_command_exception_handler
  File "samcli/commands/pipeline/init/cli.py", line 47, in cli
  File "samcli/commands/pipeline/init/cli.py", line 56, in do_cli
  File "samcli/commands/pipeline/init/interactive_init_flow.py", line 82, in do_interactive
  File "samcli/commands/pipeline/init/interactive_init_flow.py", line 107, in _generate_from_app_pipeline_templates
  File "samcli/commands/pipeline/init/interactive_init_flow.py", line 252, in _generate_from_pipeline_template
  File "samcli/commands/pipeline/init/interactive_init_flow.py", line 192, in _prompt_run_bootstrap_within_pipeline_init
  File "samcli/commands/pipeline/bootstrap/cli.py", line 407, in do_cli
  File "samcli/lib/pipeline/bootstrap/stage.py", line 338, in bootstrap
  File "samcli/lib/pipeline/bootstrap/stage.py", line 370, in _get_pipeline_user_secret_pair
  File "botocore/client.py", line 565, in _api_call
  File "botocore/client.py", line 1017, in _make_api_call

Expected result:

should create the stack in the aws account

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

  1. OS: macOS Sonoma 14.5
  2. sam --version: 1.121.0
  3. AWS region: ca-central-1
# Paste the output of `sam --info` here
{
  "version": "1.121.0",
  "system": {
    "python": "3.8.13",
    "os": "macOS-14.5-arm64-arm-64bit"
  },
  "additional_dependencies": {
    "docker_engine": "Not available",
    "aws_cdk": "Not available",
    "terraform": "Not available"
  },
  "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"
  ]
}

Add --debug flag to command you are running

mndeveci commented 1 month ago

Thanks for reporting this issue.

I've tried to re-produce it on my side, however I was able to finish execution successfully. Can you provide more details about the steps you took, especially after the Summary section?

And can you also confirm that you don't have any other error messages prior to this one, which might indicate any permission issues (your credentials not having enough scope to execute the actions)?