Closed mareksnincak closed 8 months ago
Thanks for opening your first issue here! We'll come back to you as soon as we can. In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link
Hi @mareksnincak thank you for opening the issue.
One question: could you please expound on how do you achieve point number 3 and keep the Lambda execution environment active for all these hours?
Hi, in this case I've been using it in non-lambda environment, but this are the scenarios with lambda, where I think it may happen:
"Incidentally, there was a period during the experiment week in which instances in eu-west-1 were not terminated every two hours. This resulted in three instances that ran for 48 hours. These exceptionally long lifetimes were omitted in calculating the averages and standard deviations, as such a thing didn’t happen during the other experiments, and also not in the other two regions."
I see, makes sense.
Thanks for proving the info, we'll look into it and try to reproduce the issue.
We'll report back here as soon as we have more info to share. The team is attending re:Invent next week so we might take longer than normal to triage the issue.
Hi @mareksnincak, apologies for the long wait. Between re:Invent and annual leaves I was just now able to get back to this.
After looking into this, while I didn't directly reproduce the issue, I was able to confirm that due to the token lasting only up to 24 hrs whenever the next call to AppSync happens later than that, it is expected to result in a bad request.
To guard against this occurrence I am going to open a pull request that changes the implementation to store the expiration timestamp together with the token. We will use the expiration timestamp to check if the token is still valid before retrieving a configuration, and if the token has expired, we'll start a new session and get a new token.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
This is now released under v1.18.0 version!
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:
Code snippet
Steps to Reproduce
get
method to retrieve value - this will cache the token fromGetLatestConfiguration
commandget
method to retrieve value - this will reuse expired token from previous callPossible 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