Comments (5)
I would like to take this issue :)
from powertools-lambda-typescript.
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
from powertools-lambda-typescript.
Hi @ralbertazzi - thank you for opening this issue.
I confirm that I am able to reproduce the issue:
I agree also with the fix proposed, if the value is :/etc/localtime
we should default to :UTC
. The fix should be applied in this function, which should be modified to do something like this:
public formatTimestamp(now: Date): string {
const defaultTimezone = 'UTC';
/**
* If a specific timezone is configured and it's not the default `UTC`,
* format the timestamp with the appropriate timezone offset.
**/
- const configuredTimezone = this.envVarsService?.getTimezone();
+ const envVartimezone = this.envVarsService?.getTimezone();
+ const configuredTimezone =
+ envVartimezone === ':/etc/localtime' ? defaultTimezone : envVartimezone;
if (configuredTimezone && !configuredTimezone.includes(defaultTimezone))
return this.#generateISOTimestampWithOffset(now, configuredTimezone);
return now.toISOString();
}
Additionally, we should also add a test case at the bottom of this block here to test for this case, similar to:
it('uses the default UTC timezone when the TZ env variable is set to `:/etc/localtime`', () => {
// Prepare
process.env.TZ = ':/etc/localtime';
const formatter = new PowertoolsLogFormatter({
envVarsService: new EnvironmentVariablesService(),
});
// Act
const timestamp = formatter.formatTimestamp(new Date());
// Assess
expect(timestamp).toEqual('2016-06-20T12:08:10.000Z');
});
I'll mark the issue as help-wanted
and good-first-issue
to signify that contributions are very welcome.
If nobody picks it up, we'll work on it and include the fix in the next release (~next Wednesday).
In the meantime, as a stopgap solution you can set the TZ
environment variable to :UTC
to continue using this version of Logger.
In parallel, I'll also consult the AWS Lambda team to see if the container image should align its behavior with the managed runtime & set the value to :UTC
.
from powertools-lambda-typescript.
This issue is now closed. Please be mindful that future comments 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.
from powertools-lambda-typescript.
This is now released under v2.7.0 version!
from powertools-lambda-typescript.
Related Issues (20)
- [Support Lambda Powertools]: WeSchool HOT 4
- Maintenance: create event-handler workspace HOT 2
- [Support Powertools for AWS Lambda]: LocalStack HOT 4
- Feature request: set correlation ID in Logger
- Bug: GetParameterError: Signature expired HOT 3
- Feature request: Put parameter HOT 3
- Maintenance: swap `cached-node-modules` GitHub Action with centralized one HOT 2
- Feature request: manipulating the idempotent response HOT 1
- Docs: add parser example to extend built-in schema with JSON parse HOT 2
- Feature request: add helper function to transform and pipe JSON strings to a custom schema HOT 2
- Maintenance: extract lru-cache implementation into commons package HOT 2
- Feature request: support metrics with unit "None" HOT 2
- Maintenance: replace usage of `ADD` in docs Dockerfile HOT 1
- Bug: IdempotencyPersistenceLayerError cause undefined HOT 3
- Maintenance: remove duplication in Idempotency tests HOT 1
- Maintenance: fix `typedoc-plugin-zod` usage HOT 1
- Maintenance: add vitest to project HOT 1
- Maintenance: migrate Batch Processing unit tests to vitest
- Maintenance: migrate internal Testing Utils unit tests to vitest
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powertools-lambda-typescript.