### Install Dependencies and Setup Hooks Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/contributing/setup.md Run this command to install all local dependencies and set up pre-commit hooks. ```bash npm run setup-local ``` -------------------------------- ### Setup Local Documentation Environment with Python Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/contributing/setup.md Create a virtual environment and install Python dependencies for running the documentation locally without Docker. ```bash npm run docs:local:setup ``` -------------------------------- ### Install Kafka with Protobuf.js Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/getting-started/installation.md Install the Kafka utility along with protobufjs for Protocol Buffers serialization. ```bash npm i @aws-lambda-powertools/kafka protobufjs ``` -------------------------------- ### Get started with SQS batch processing Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/batch.md Instantiate BatchProcessor for SQS, define a record handler, and use processPartialResponse to process messages. This example demonstrates basic SQS batch processing. ```typescript import { BatchProcessor, EventType } from "@aws-lambda-powertools/batch"; const processor = new BatchProcessor(EventType.SQS); interface MyRecord { messageId: string; body: string; } const handler = async (record: MyRecord) => { console.log("Processing record:", record.messageId); // Your processing logic here return Promise.resolve(); }; export const lambdaHandler = async (event: any, context: any) => { await processor.processPartialResponse(event, handler); }; ``` -------------------------------- ### Install Powertools Commons Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/commons/README.md Install the utility by running this command in your project. ```sh npm i @aws-lambda-powertools/commons ``` -------------------------------- ### Logger Output - First Invocation Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/logger.md Example of logger output during the first invocation, showing initial state and cold start information. ```json { "environment": "prod", "cold_start": true, "userId": "123456789012", "foo": "bar", "function_arn": "arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function", "function_memory_size": 128, "function_name": "foo-bar-function", "function_request_id": "abcdef123456abcdef123456", "level": "INFO", "message": "WIDE", "service": "hello-world", "timestamp": "2021-12-12T22:32:54.670Z", "xray_trace_id": "1-5759e988-bd862e3fe1be46a994272793" } ``` -------------------------------- ### Install Tracer Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/getting-started/installation.md Install the Tracer utility package using npm. ```bash npm i @aws-lambda-powertools/tracer ``` -------------------------------- ### Install DynamoDBProvider Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/parameters.md Install the Parameters utility and the AWS SDK v3 DynamoDB and util-dynamodb packages for DynamoDBProvider. ```bash npm install @aws-lambda-powertools/parameters @aws-sdk/client-dynamodb @aws-sdk/util-dynamodb ``` -------------------------------- ### Install Idempotency with Valkey Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/idempotency.md Install the idempotency library along with the Valkey peer dependencies. ```shell npm i @aws-lambda-powertools/idempotency @valkey/valkey-glide ``` -------------------------------- ### Install Metrics Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/getting-started/installation.md Install the Metrics utility package using npm. ```bash npm i @aws-lambda-powertools/metrics ``` -------------------------------- ### Get started with Kinesis batch processing Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/batch.md Instantiate BatchProcessor for Kinesis Data Streams, define a record handler, and use processPartialResponse. This example demonstrates basic Kinesis batch processing. ```typescript import { BatchProcessor, EventType } from "@aws-lambda-powertools/batch"; const processor = new BatchProcessor(EventType.KinesisDataStreams); interface MyRecord { sequenceNumber: string; data: string; } const handler = async (record: MyRecord) => { console.log("Processing record:", record.sequenceNumber); // Your processing logic here return Promise.resolve(); }; export const lambdaHandler = async (event: any, context: any) => { await processor.processPartialResponse(event, handler); }; ``` -------------------------------- ### Install Event Handler Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/event-handler/bedrock-agents.md Install the Event Handler package using npm. ```shell npm i @aws-lambda-powertools/event-handler ``` -------------------------------- ### Install SSMProvider Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/parameters.md Install the Parameters utility and the AWS SDK v3 SSM client package for SSMProvider. ```bash npm install @aws-lambda-powertools/parameters @aws-sdk/client-ssm ``` -------------------------------- ### Install Dependencies and Deploy Stack Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/examples/app/README.md Install project dependencies and deploy the CDK stack. Follow prompts for deployment. ```bash npm i --prefix ./ npm run cdk deploy ``` -------------------------------- ### Install Kafka Utility for Protobuf Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/kafka.md Install the Kafka utility package along with the protobufjs library for Protocol Buffers deserialization. ```bash npm install @aws-lambda-powertools/kafka protobufjs ``` -------------------------------- ### Install Parameters with SSM SDK Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/getting-started/installation.md Install the Parameters utility along with the necessary AWS SDK v3 SSM client. ```bash npm i @aws-lambda-powertools/parameters @aws-sdk/client-ssm ``` -------------------------------- ### Example Log Output with Lambda Context Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/logger/README.md This JSON output demonstrates the structured log format when Lambda context is injected, including details like cold start status, function ARN, and trace ID. ```json { "cold_start": true, "function_arn": "arn:aws:lambda:eu-west-1:123456789012:function:shopping-cart-api-lambda-prod-eu-west-1", "function_memory_size": 128, "function_request_id": "c6af9ac6-7b61-11e6-9a41-93e812345678", "function_name": "shopping-cart-api-lambda-prod-eu-west-1", "level": "INFO", "message": "This is an INFO log with some context", "service": "serverlessAirline", "timestamp": "2021-12-12T21:21:08.921Z", "xray_trace_id": "abcdef123456abcdef123456abcdef123456" } ``` -------------------------------- ### Install Kafka with Avro-js Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/getting-started/installation.md Install the Kafka utility along with avro-js for Avro serialization. ```bash npm i @aws-lambda-powertools/kafka avro-js ``` -------------------------------- ### Install Idempotency Package and AWS SDK Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/idempotency.md Install the necessary packages for the idempotency utility and AWS SDK for DynamoDB. This is required before configuring IAM permissions and table setup. ```shell npm i @aws-powertools/idempotency @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb ``` -------------------------------- ### Install Parameters with AppConfig SDK Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/getting-started/installation.md Install the Parameters utility along with the necessary AWS SDK v3 AppConfigData client. ```bash npm i @aws-lambda-powertools/parameters @aws-sdk/client-appconfigdata ``` -------------------------------- ### Install Validation Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/validation.md Install the validation package using npm. ```bash npm install @aws-lambda-powertools/validation ``` -------------------------------- ### Install Logger Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/getting-started/installation.md Install the Logger utility package using npm. ```bash npm i @aws-lambda-powertools/logger ``` -------------------------------- ### Install Kafka Utility for JSON Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/kafka.md Install the Kafka utility package for JSON deserialization using npm. ```bash npm install @aws-lambda-powertools/kafka ``` -------------------------------- ### Install Parser with Zod Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/getting-started/installation.md Install the Parser utility along with Zod for schema validation. ```bash npm i @aws-lambda-powertools/parser zod ``` -------------------------------- ### User Schema Example (Protobuf) Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/kafka.md Example of a user schema in Protobuf format, used for Kafka messages. ```typescript syntax = "proto3"; package user; message User { string name = 1; int32 age = 2; } ``` -------------------------------- ### Implementation of a custom parameter provider (HashiCorp Vault) Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/parameters.md Provides the implementation for a custom parameter provider extending BaseProvider. This example shows how to fetch secrets from HashiCorp Vault, implementing the necessary get and getMultiple methods. ```typescript import { BaseProvider, type ProviderConfig } from "@aws-lambda-powertools/parameters"; import { type VaultClient } from "./vaultClient"; // Assuming you have a Vault client interface VaultProviderConfig extends ProviderConfig { // Vault specific configuration vaultUrl?: string; } export class VaultProvider extends BaseProvider { private readonly vaultClient: VaultClient; constructor(config: VaultProviderConfig) { super(config); this.vaultClient = new VaultClient(config.vaultUrl); } protected async get(key: string): Promise { // Implementation to get a single parameter from Vault const secret = await this.vaultClient.readSecret(key); return secret.data.value; } protected async getMultiple(key: string): Promise> { // Implementation to get multiple parameters from Vault (if applicable) const secrets = await this.vaultClient.readSecretsByPrefix(key); const result: Record = {}; for (const secret of secrets) { result[secret.key] = secret.data.value; } return result; } } ``` -------------------------------- ### Install Idempotency with Redis OSS Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/idempotency.md Install the idempotency library along with the Redis OSS peer dependencies. ```shell npm i @aws-lambda-powertools/idempotency @redis/client ``` -------------------------------- ### Install Parser Utility and Zod Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/parser/README.md Install the necessary packages for the parser utility and Zod schema validation. ```sh npm install @aws-lambda-powertools/parser zod ``` -------------------------------- ### Install Kafka Utility for Avro Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/kafka.md Install the Kafka utility package along with the avro-js library for Avro deserialization. ```bash npm install @aws-lambda-powertools/kafka avro-js ``` -------------------------------- ### Install Metrics Utility Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/metrics.md Install the Metrics utility using npm. Ensure you are using version 1.15.0 or newer if Lambda Advanced Logging Controls are enabled. ```shell npm install @aws-lambda-powertools/metrics ``` -------------------------------- ### Install Validation Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/getting-started/installation.md Install the Validation utility package, which has 'ajv' as a default dependency. ```bash npm i @aws-lambda-powertools/validation ``` -------------------------------- ### User Schema Example (JSON) Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/kafka.md Example of a user schema in JSON format for Kafka messages. ```json { "name": "John Doe", "age": 30 } ``` -------------------------------- ### Install Parameters with Secrets Manager SDK Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/getting-started/installation.md Install the Parameters utility along with the necessary AWS SDK v3 Secrets Manager client. ```bash npm i @aws-lambda-powertools/parameters @aws-sdk/client-secrets-manager ``` -------------------------------- ### Install Idempotency with DynamoDB SDK Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/getting-started/installation.md Install the Idempotency utility along with the necessary AWS SDK v3 DynamoDB clients. ```bash npm i @aws-lambda-powertools/idempotency @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb ``` -------------------------------- ### User Schema Example (Avro) Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/kafka.md Example of a user schema in Avro format, suitable for Kafka messages. ```json { "type": "record", "name": "User", "fields": [ {"name": "name", "type": "string"}, {"name": "age", "type": "int"} ] } ``` -------------------------------- ### Install JMESPath Utility Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/jmespath/README.md Install the JMESPath utility package using npm. This is the first step to using its data extraction capabilities. ```sh npm i @aws-lambda-powertools/jmespath ``` -------------------------------- ### Install Event Handler Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/README.md Install the Event Handler package using npm. This package simplifies event processing in Lambda functions. ```bash npm install @aws-lambda-powertools/event-handler ``` -------------------------------- ### Install Metrics Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/README.md Install the Metrics package using npm. This package is used for emitting custom metrics from your Lambda functions. ```bash npm install @aws-lambda-powertools/metrics ``` -------------------------------- ### Install Batch Processing Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/README.md Install the Batch Processing package using npm. This package provides utilities for handling batch events in Lambda. ```bash npm install @aws-lambda-powertools/batch ``` -------------------------------- ### Install Logger Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/README.md Install the Logger package using npm. This is a foundational step for using the logging capabilities of AWS Lambda Powertools. ```bash npm install @aws-lambda-powertools/logger ``` -------------------------------- ### Run Documentation Website with Python Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/contributing/setup.md Start the documentation website locally using Python after setting up the environment. ```bash npm run docs:local:run ``` -------------------------------- ### Get started with DynamoDB Streams batch processing Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/batch.md Instantiate BatchProcessor for DynamoDB Streams, define a record handler, and use processPartialResponse. This example demonstrates basic DynamoDB Streams batch processing. ```typescript import { BatchProcessor, EventType } from "@aws-lambda-powertools/batch"; import { DynamoDBRecord } from "aws-lambda"; const processor = new BatchProcessor(EventType.DynamoDBStreams); const handler = async (record: DynamoDBRecord) => { console.log("Processing record:", record.eventID); // Your processing logic here return Promise.resolve(); }; export const lambdaHandler = async (event: any, context: any) => { await processor.processPartialResponse(event, handler); }; ``` -------------------------------- ### Run Documentation Website with Docker Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/contributing/setup.md Start the documentation website locally using the Docker image. ```bash npm run docs:docker:run ``` -------------------------------- ### Build Docker Image for Documentation Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/contributing/setup.md Build the Docker image for running the documentation website. This is only needed the first time. ```bash npm run docs:docker:build ``` -------------------------------- ### Basic Tracer Usage in Lambda Handler Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/tracer.md Instantiate the Tracer utility outside the Lambda handler for resource reuse and cold start annotation. This example demonstrates basic usage within a TypeScript handler. ```typescript import { Tracer } from "@aws-lambda-powertools/tracer"; const tracer = new Tracer("serviceName"); export const handler = async (event: any, context: any): Promise => { tracer.annotateLambdaContext(event, context); tracer.addLambdaFunctionUrlAnnotation(); // Your Lambda function logic here }; ``` -------------------------------- ### Use Correlation ID with Middy.js Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/logger.md Integrate correlation ID extraction within a Middy.js middleware setup. This example shows how to use the logger's correlation ID functionality in conjunction with event processing middleware. ```typescript import { Logger } from "@aws-lambda-powertools/logger"; import middy from "@middy/core"; const logger = new Logger({ correlationIdSearchFn: (payload) => { return payload.requestContext.requestId; }, }); const lambdaHandler = async (event) => { logger.info("Processing request"); }; export const handler = middy(lambdaHandler); ``` -------------------------------- ### Get started with SQS FIFO batch processing with skipGroupOnError Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/batch.md Instantiate BatchProcessor for SQS FIFO queues with the skipGroupOnError option enabled, define a record handler, and use processPartialResponse. This allows processing to continue from other group IDs if one fails. ```typescript import { BatchProcessor, EventType } from "@aws-lambda-powertools/batch"; const processor = new BatchProcessor(EventType.SQS, { skipGroupOnError: true }); interface MyRecord { messageId: string; body: string; } const handler = async (record: MyRecord) => { console.log("Processing record:", record.messageId); // Your processing logic here return Promise.resolve(); }; export const lambdaHandler = async (event: any, context: any) => { await processor.processPartialResponse(event, handler); }; ``` -------------------------------- ### Install Data Masking Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/data-masking.md Install the Data Masking package for your TypeScript Lambda function. For encryption/decryption, also install the AWS Encryption SDK. ```bash npm install @aws-lambda-powertools/data-masking ``` ```bash npm install @aws-crypto/client-node ``` -------------------------------- ### Deploy CDK Stack Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/examples/app/README.md Bootstrap your AWS account for CDK and deploy the sample application. Replace placeholders with your AWS account ID, region, and profile. ```bash npm run cdk bootstrap aws:/// --profile ``` -------------------------------- ### Install Data Masking Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/data-masking/README.md Install the data masking package using npm. ```sh npm i @aws-lambda-powertools/data-masking ``` -------------------------------- ### Install Parameters Package Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/README.md Install the Parameters package and the AWS SDK client for SSM using npm. This is required for fetching parameters from AWS Systems Manager. ```bash npm install @aws-lambda-powertools/parameters @aws-sdk/client-ssm ``` -------------------------------- ### AppSync SAM Template Example Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/event-handler/appsync-graphql.md This is a sample AWS SAM template for deploying an AppSync GraphQL API with a Lambda resolver. ```yaml AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: AppSync Lambda Resolver Example Globals: Function: Timeout: 10 MemorySize: 128 Runtime: nodejs18.x Architectures: - x86_64 Resources: AppSyncApi: Type: AWS::AppSync::GraphQLApi Properties: Name: AppSyncLambdaResolverExample AuthenticationType: API_KEY AppSyncSchema: Type: AWS::AppSync::GraphQLSchema Properties: ApiId: !Ref AppSyncApi DefinitionS3Location: !Sub 's3://${ArtifactsBucket}/schema.graphql' AppSyncNoneAuthDataSource: Type: AWS::AppSync::DataSource Properties: ApiId: !Ref AppSyncApi Name: NoneAuthDataSource Type: NONE AppSyncLambdaDataSource: Type: AWS::AppSync::DataSource Properties: ApiId: !Ref AppSyncApi Name: LambdaDataSource Type: AWS_LAMBDA LambdaConfig: LambdaFunctionArn: !GetAtt LambdaFunction.Arn AppSyncNoneAuthResolver: Type: AWS::AppSync::Resolver Properties: ApiId: !Ref AppSyncApi TypeName: Query FieldName: _ DataSourceName: !Ref AppSyncNoneAuthDataSource AppSyncQueryResolver: Type: AWS::AppSync::Resolver Properties: ApiId: !Ref AppSyncApi TypeName: Query FieldName: listTodos DataSourceName: !Ref AppSyncLambdaDataSource RequestMappingTemplate: | { "version": "2017-02-28", "operation": "Invoke", "payload": { "typeName": "Query", "fieldName": "listTodos", "arguments": $utils.toJson($context.arguments) } } ResponseMappingTemplate: | $utils.toJson($context.result) AppSyncMutationResolver: Type: AWS::AppSync::Resolver Properties: ApiId: !Ref AppSyncApi TypeName: Mutation FieldName: createTodo DataSourceName: !Ref AppSyncLambdaDataSource RequestMappingTemplate: | { "version": "2017-02-28", "operation": "Invoke", "payload": { "typeName": "Mutation", "fieldName": "createTodo", "arguments": $utils.toJson($context.arguments) } } ResponseMappingTemplate: | $utils.toJson($context.result) LambdaFunction: Type: AWS::Serverless::Function Properties: CodeUri: src/ Handler: index.handler Events: AppSyncEvent: Type: Api Properties: RestApiId: !Ref AppSyncApi Path: /graphql Method: post Outputs: AppSyncApiUrl: Description: "The AppSync API URL." Value: !Sub "https://${AppSyncApi}.appsync-api.${AWS::Region}.amazonaws.com/graphql" AppSyncApiKey: Description: "The AppSync API Key." Value: !GetAtt AppSyncApi.ApiKey ``` -------------------------------- ### Capture Cold Start Metric with Middy Middleware Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/metrics.md Use the `logMetrics` middleware with `captureColdStartMetric` enabled to automatically capture cold start invocations as a separate EMF metric. This keeps cold start metrics distinct from application metrics. ```typescript import { captureLambdaTraces } from "@aws-lambda-powertools/tracer"; import { logMetrics, MetricUnits } from "@aws-lambda-powertools/metrics"; import middy from "@middy/core"; import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from "aws-lambda"; const lambdaTracer = captureLambdaTraces(); const lambdaHandler = async (event: APIGatewayProxyEvent, context: Context): Promise => { const response = { statusCode: 200, body: JSON.stringify({ message: "Hello World!" }), }; return response; }; export const handler = middy(lambdaHandler) .use(lambdaTracer) .use(logMetrics({ namespace: "CustomNamespace", service: "myService", captureColdStartMetric: true })); ``` -------------------------------- ### Initialize Metrics and Add Metrics Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/metrics/README.md Initialize the Metrics class with namespace, service name, and default dimensions. Add metadata and metrics using `addMetadata()` and `addMetric()`, then publish stored metrics. ```typescript import { Metrics, MetricUnit } from '@aws-lambda-powertools/metrics'; const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName: 'orders', defaultDimensions: { environment: process.env.ENVIRONMENT }, }); export const handler = async (event: { requestId: string }) => { metrics.addMetadata('request_id', event.requestId); metrics.addMetric('successfulBooking', MetricUnit.Count, 1); metrics.publishStoredMetrics(); }; ``` -------------------------------- ### Using AppConfigProvider for Extensibility Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/features/parameters.md Instantiate and use the `AppConfigProvider` class directly for advanced configurations. This provider requires the application and environment to be specified during initialization or via the `POWERTOOLS_SERVICE_NAME` environment variable. ```typescript import { AppConfigProvider } from "@aws-powertools/parameters/appconfig"; // Example with application and environment provided const appConfigProvider = new AppConfigProvider({ application: "my-app", environment: "dev", }); const myConfig = await appConfigProvider.get("MY_CONFIG_KEY"); // Example using environment variables for application // const appConfigProviderWithEnv = new AppConfigProvider({ // environment: "prod", // }); ``` -------------------------------- ### Unit Test Logger Info Method with Prepare, Act, Assess Source: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/contributing/testing.md Implement unit tests following the Prepare, Act, Assess pattern. This example demonstrates testing the Logger class's info method by setting up the logger, calling the method, and asserting the expected outcome. ```typescript describe('Class: Logger', () => { describe('Method: info', () => { it('should log info message', () => { // Prepare const logger = new Logger() // Act logger.info('test') // Assess expect(logger.info).toHaveBeenCalledWith('test') }) }) }) ```