Closed
Description
The base image used to build Docker images, public.ecr.aws/lambda/nodejs:20
, sets the environment variable TZ=:/etc/localtime
. This value is not recognised as valid one and throws an error. I believe this was introduced by this PR that was merged in 2.4.0.
Expected Behavior
Building a Docker Lambda using the logger library without further configuration, i.e. I'd expect the library to print times in UTC when TZ is :/etc/localtime
Current Behavior
RangeError: Invalid time zone specified: :/etc/localtime
is raised when logging anything under this condition
Code snippet
import { Logger } from "@aws-lambda-powertools/logger";
const log = new Logger();
log.info("Hello");
Steps to Reproduce
- Build a Docker Lambda from
public.ecr.aws/lambda/nodejs:20
- Install the logger library
- Log something
Possible Solution
The library should print times in UTC when TZ is :/etc/localtime
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
20.x
Packaging format used
npm
Execution logs
RangeError: Invalid time zone specified: :/etc/localtime
at new DateTimeFormat (<anonymous>)
at #getDateFormatter (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@aws-lambda-powertools/logger/lib/cjs/formatter/LogFormatter.js:85:16)
at #generateISOTimestampWithOffset (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@aws-lambda-powertools/logger/lib/cjs/formatter/LogFormatter.js:103:82)
at PowertoolsLogFormatter.formatTimestamp (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@aws-lambda-powertools/logger/lib/cjs/formatter/LogFormatter.js:53:56)
at PowertoolsLogFormatter.formatAttributes (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@aws-lambda-powertools/logger/lib/cjs/formatter/PowertoolsLogFormatter.js:32:29)
at Logger.createAndPopulateLogItem (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@aws-lambda-powertools/logger/lib/cjs/Logger.js:722:39)
at Logger.processLogItem (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@aws-lambda-powertools/logger/lib/cjs/Logger.js:827:46)
at Logger.info (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@aws-lambda-power
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Shipped