-
Notifications
You must be signed in to change notification settings - Fork 171
Closed
Labels
bugSomething isn't workingSomething isn't workingcompletedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedparametersThis item relates to the Parameters UtilityThis item relates to the Parameters Utility
Description
Expected Behaviour
AppConfigProvider get method shouldn't fail, when there is more than 24 hours between calls.
Current Behaviour
AppConfigProvider get method fails, when there is more than 24 hours between calls.
Cause:
- token is set in https://github.com/aws-powertools/powertools-lambda-typescript/blob/v1.16.0/packages/parameters/src/appconfig/AppConfigProvider.ts#L316
- token is reused in https://github.com/aws-powertools/powertools-lambda-typescript/blob/v1.16.0/packages/parameters/src/appconfig/AppConfigProvider.ts#L289 even when it already expired - according to https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-retrieving-the-configuration.html tokens are only valid for 24 hours
Code snippet
const appConfigProvider = new AppConfigProvider({
application: "my-app",
environment: "my-env",
clientConfig: { region: "us-east-1" },
});
await appConfigProvider.get("my-config");
// Wait more than 24 hours...
await appConfigProvider.get("my-config");
Steps to Reproduce
- Initiate app config provider
- call
get
method to retrieve value - this will cache the token fromGetLatestConfiguration
command - wait more than 24 hours - without killing the environment and calling get method again
- call
get
method to retrieve value - this will reuse expired token from previous call
Possible Solution
Set cache to expire after e.g. 23 hours - cache retrieval in https://github.com/aws-powertools/powertools-lambda-typescript/blob/v1.16.0/packages/parameters/src/appconfig/AppConfigProvider.ts#L289 should be updated to not return expired token.
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
18.x
Packaging format used
npm
Execution logs
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcompletedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedparametersThis item relates to the Parameters UtilityThis item relates to the Parameters Utility
Type
Projects
Status
Shipped