Skip to content

Conversation

@sannya-singal
Copy link
Contributor

This PR enhances the usability and devX of the awslocal by logging stack traces only when --debug is passed and displaying only error messages by default, matching awscli behavior.

Current Behaviour

sannyasingal@Sannyas-MacBook-Pro ~ % CUSTOMIZE_ACCESS_KEY=1 AWS_ACCESS_KEY_ID=444444444444  awslocal kms create-key 
Traceback (most recent call last):
  File "/Users/sannyasingal/.pyenv/versions/3.11.9/bin/awslocal", line 87, in main
    import awscli.clidriver  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'awscli'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sannyasingal/.pyenv/versions/3.11.9/bin/awslocal", line 268, in <module>
    main()
  File "/Users/sannyasingal/.pyenv/versions/3.11.9/bin/awslocal", line 89, in main
    return run_as_separate_process()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sannyasingal/.pyenv/versions/3.11.9/bin/awslocal", line 151, in run_as_separate_process
    env_dict = prepare_environment()
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sannyasingal/.pyenv/versions/3.11.9/bin/awslocal", line 104, in prepare_environment
    credentials = session.get_credentials()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sannyasingal/.pyenv/versions/3.11.9/lib/python3.11/site-packages/boto3/session.py", line 201, in get_credentials
    return self._session.get_credentials()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sannyasingal/.pyenv/versions/3.11.9/lib/python3.11/site-packages/botocore/session.py", line 515, in get_credentials
    ).load_credentials()
      ^^^^^^^^^^^^^^^^^^
  File "/Users/sannyasingal/.pyenv/versions/3.11.9/lib/python3.11/site-packages/botocore/credentials.py", line 2074, in load_credentials
    creds = provider.load()
            ^^^^^^^^^^^^^^^
  File "/Users/sannyasingal/.pyenv/versions/3.11.9/lib/python3.11/site-packages/botocore/credentials.py", line 1149, in load
    credentials = fetcher(require_expiry=False)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sannyasingal/.pyenv/versions/3.11.9/lib/python3.11/site-packages/botocore/credentials.py", line 1189, in fetch_credentials
    raise PartialCredentialsError(
botocore.exceptions.PartialCredentialsError: Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY

Expected Behaviour:

sannyasingal@Sannyas-MacBook-Pro ~ % CUSTOMIZE_ACCESS_KEY=1 AWS_ACCESS_KEY_ID=444444444444  awslocal kms create-key

Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY

@sannya-singal sannya-singal self-assigned this Aug 1, 2025
@sannya-singal sannya-singal requested a review from k-a-il August 4, 2025 07:25
@sannya-singal sannya-singal marked this pull request as ready for review August 4, 2025 07:25
@alexrashed alexrashed removed their request for review August 5, 2025 11:07
@sannya-singal sannya-singal force-pushed the stack-trace-debug-only branch from 25ac6d8 to 8f83f4f Compare August 6, 2025 05:59
@github-actions
Copy link

github-actions bot commented Aug 6, 2025

Smoke Tests

 6 files  ±0  12 suites  ±0   3m 22s ⏱️ -1s
 4 tests ±0   4 ✅ ±0  0 💤 ±0  0 ❌ ±0 
24 runs  ±0  24 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 45827c9. ± Comparison against base commit 11c02f6.

♻️ This comment has been updated with latest results.

Copy link

@k-a-il k-a-il left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one minor issue with different versions defined in setup.py and README.m. Please fix before merging, otherwise LGTM

@sannya-singal sannya-singal merged commit db9f241 into master Aug 7, 2025
8 checks passed
@sannya-singal sannya-singal deleted the stack-trace-debug-only branch August 7, 2025 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants