Skip to content

Conversation

BeckettFrey
Copy link
Contributor

@BeckettFrey BeckettFrey commented Aug 12, 2025

Summary

This PR refactors the Idempotency utility to replace the EnvironmentVariablesService class-based approach with functional helper utilities from the commons package. The changes eliminate class inheritance and instantiation in favor of direct function calls, improving performance, reducing bundle size, and increasing consistency across the Powertools codebase.

Changes

  • IdempotencyConfig: Replaced EnvironmentVariablesService instantiation with direct getBooleanFromEnv() call for POWERTOOLS_IDEMPOTENCY_DISABLED environment variable
  • BasePersistenceLayer: Replaced EnvironmentVariablesService usage with direct getStringFromEnv() call for AWS_LAMBDA_FUNCTION_NAME environment variable
  • Security Enhancement: Implemented true runtime-private methods using # private field syntax
  • Code Cleanup: Removed unused EnvironmentVariablesService.ts and associated test files

Related Work: This continues the architectural modernization started in #4251 (Logger utility), applying the same functional pattern to the Idempotency utility as part of the broader initiative to eliminate class-based environment services across all Powertools packages.

Issue number: closes #4246 & #4247


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

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

Copy link

boring-cyborg bot commented Aug 12, 2025

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

@boring-cyborg boring-cyborg bot added idempotency This item relates to the Idempotency Utility tests PRs that add or change tests labels Aug 12, 2025
@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Aug 12, 2025
@boring-cyborg boring-cyborg bot added the commons This item relates to the Commons Utility label Aug 12, 2025
@BeckettFrey
Copy link
Contributor Author

@dreamorosi Thanks for the clear scope and guidance, let me know how I did when you get a chance.

@BeckettFrey BeckettFrey requested a review from svozza August 12, 2025 19:38
Copy link

@svozza
Copy link
Contributor

svozza commented Aug 12, 2025

Thank you for the contribution, merging now!

@svozza svozza merged commit 92c7f36 into aws-powertools:main Aug 12, 2025
34 checks passed
Copy link

boring-cyborg bot commented Aug 12, 2025

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

Copy link
Contributor

@aws-powertools/lambda-typescript No related issues found. Please ensure 'pending-release' label is applied before releasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commons This item relates to the Commons Utility idempotency This item relates to the Idempotency Utility size/L PRs between 100-499 LOC tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maintenance: replace EnvironmentVariablesService class with helper functions in Idempotency
2 participants