Skip to content

fix:Removing env var credentials provider as default. #1161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 5, 2023
Merged

fix:Removing env var credentials provider as default. #1161

merged 7 commits into from
Jun 5, 2023

Conversation

msailes
Copy link
Contributor

@msailes msailes commented May 16, 2023

Issue #, if available:
#1160

Description of changes:

SnapStart uses a different credentials provider to on-demand, so when it is hardcoded like this, the default will fail.

Lambda sets the env var AWS_LAMBDA_INITIALIZATION_TYPE to either snap-start or on-demand depending on the mode. We can use this to configure the DynamoDB correctly.

Testing this is difficult, the configuration isn't an open attribute, so I don't think I can write a unit test easily (please let me know if I'm wrong). An integration test would be best.

Checklist

Breaking change checklist

RFC issue #:

  • Migration process documented
  • Implement warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

SnapStart uses a different credentials provider so when it is hardcoded like this, the default will fail.
@codecov-commenter
Copy link

codecov-commenter commented May 16, 2023

Codecov Report

Patch coverage: 16.66% and project coverage change: -0.13 ⚠️

Comparison is base (c82de63) 71.32% compared to head (68bbf7e) 71.20%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1161      +/-   ##
============================================
- Coverage     71.32%   71.20%   -0.13%     
  Complexity      535      535              
============================================
  Files            70       71       +1     
  Lines          2239     2240       +1     
  Branches        237      240       +3     
============================================
- Hits           1597     1595       -2     
- Misses          529      532       +3     
  Partials        113      113              
Impacted Files Coverage Δ
...mbda/powertools/core/internal/LambdaConstants.java 0.00% <0.00%> (ø)
...mazon/lambda/powertools/idempotency/Constants.java 0.00% <ø> (ø)
...azon/lambda/powertools/parameters/SSMProvider.java 68.18% <11.11%> (-0.48%) ⬇️
.../lambda/powertools/parameters/SecretsProvider.java 51.35% <11.11%> (-1.29%) ⬇️
...mpotency/persistence/DynamoDBPersistenceStore.java 88.11% <25.00%> (-1.25%) ⬇️
.../idempotency/persistence/BasePersistenceStore.java 88.23% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

SnapStart uses a different credentials provider so when it is hardcoded like this, the default will fail.
// AWS_LAMBDA_INITIALIZATION_TYPE has two values on-demand and snap-start
// when using snap-start mode, the env var creds provider isn't used and causes a fatal error
// fall back to the default provider chain if the mode is anything other than on-demand.
if (System.getenv().get(Constants.AWS_LAMBDA_INITIALIZATION_TYPE) == "on-demand") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Problem: An equality operator (== or !=) is used to compare strings, which matches strings based on address.

Fix: Do content comparison using the equals() method to compare the values of the strings.

Copy link
Contributor

Choose a reason for hiding this comment

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

solved

jeromevdl
jeromevdl previously approved these changes May 16, 2023
Copy link
Contributor

@jeromevdl jeromevdl left a comment

Choose a reason for hiding this comment

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

👍

@scottgerring scottgerring self-assigned this Jun 2, 2023
Copy link
Contributor

@jeromevdl jeromevdl left a comment

Choose a reason for hiding this comment

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

Good to go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants