Skip to content

docs: clarify version mismatch risks #4103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The toolkit is compatible with both TypeScript and JavaScript code bases, and su
All features are available as individual packages, so you can install only the ones you need, for example:

* **Logger**: `npm i @aws-lambda-powertools/logger`{.copyMe}
* **Event Handler**: `npm i @aws-lambda-powertools/event-handler`{.copyMe}
* **Metrics**: `npm i @aws-lambda-powertools/metrics`{.copyMe}
* **Tracer**: `npm i @aws-lambda-powertools/tracer`{.copyMe}

Expand All @@ -21,12 +22,14 @@ See the [Features](../features/index.md) page for a complete list of available u

Some features use additional dependencies like the AWS SDK for JavaScript v3, which might you need to install separately. Below is a list of utilities that use external dependencies, and the packages you need to install to use them.

| Feature | Install | Default dependency |
| -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------- |
| **[Tracer](../features/tracer.md)** | **`npm i @aws-lambda-powertools/tracer`**{.copyMe} | `aws-xray-sdk-core` |
| **[Idempotency](../features/idempotency.md)** | **`npm i @aws-lambda-powertools/idempotency @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb`**{.copyMe} | |
| **[Parameters (SSM)](../features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-ssm`**{.copyMe} | |
| **[Parameters (Secrets Manager)](../features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-secrets-manager`**{.copyMe} | |
| **[Parameters (AppConfig)](../features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-appconfigdata`**{.copyMe} | |
| **[Parser](../features/parser.md)** | **`npm i @aws-lambda-powertools/parser zod@~3`**{.copyMe} | |
| **[Validation](../features/validation.md)** | **`npm i @aws-lambda-powertools/validation`**{.copyMe} | `ajv` |
| Feature | Install | Default dependency |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------------- |
| **[Tracer](../features/tracer.md)** | **`npm i @aws-lambda-powertools/tracer`**{.copyMe} | `aws-xray-sdk-core` |
| **[Idempotency](../features/idempotency.md)** | **`npm i @aws-lambda-powertools/idempotency @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb`**{.copyMe} | |
| **[Parameters (SSM)](../features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-ssm`**{.copyMe} | |
| **[Parameters (Secrets Manager)](../features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-secrets-manager`**{.copyMe} | |
| **[Parameters (AppConfig)](../features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-appconfigdata`**{.copyMe} | |
| **[Parser](../features/parser.md)** | **`npm i @aws-lambda-powertools/parser zod@~3`**{.copyMe} | |
| **[Validation](../features/validation.md)** | **`npm i @aws-lambda-powertools/validation`**{.copyMe} | `ajv` |
| **[Kafka (Protocol Buffers)](../features/kafka.md)** | **`npm i @aws-lambda-powertools/kafka protobufjs`**{.copyMe} | |
| **[Kafka (Avro)](../features/kafka.md)** | **`npm i @aws-lambda-powertools/kafka avro-js`**{.copyMe} | |
74 changes: 48 additions & 26 deletions docs/getting-started/lambda-layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,33 +88,38 @@ The pre-signed URL to download this Lambda Layer will be within `Location` key i

Change `{aws::region}` to your AWS region, e.g. `eu-west-1`, and run the following command:

```bash title="AWS CLI command to download Lambda Layer content"
aws lambda get-layer-version-by-arn --arn arn:aws:lambda:{aws::region}:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:29 --region {aws::region}
=== "AWS CLI command to download Lambda Layer content"

# output
{
"Content": {,
"Location": "https://awslambda-eu-west-1-layers.s3.eu-west-1.amazonaws.com/...",
"CodeSha256": "gwGIE8w0JckdDeDCTX6FbWObb2uIDwgiaAq78gMWDyA=",
"CodeSize": 3548324
},
"LayerArn": "arn:aws:lambda:eu-west-1:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2",
"LayerVersionArn": "arn:aws:lambda:eu-west-1:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:29",
"Description": "Powertools for AWS Lambda (TypeScript) version 2.18.0",
"CreatedDate": "2025-04-08T07:38:30.424+0000",
"Version": 24,
"CompatibleRuntimes": [
"nodejs18.x",
"nodejs20.x",
"nodejs22.x"
],
"LicenseInfo": "MIT-0",
"CompatibleArchitectures": [
"arm64",
"x86_64"
]
}
```
```bash
aws lambda get-layer-version-by-arn --arn arn:aws:lambda:{aws::region}:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:29 --region {aws::region}
```

=== "AWS CLI output"

```json
{
"Content": {
"Location": "https://awslambda-eu-west-1-layers.s3.eu-west-1.amazonaws.com/...",
"CodeSha256": "gwGIE8w0JckdDeDCTX6FbWObb2uIDwgiaAq78gMWDyA=",
"CodeSize": 3548324
},
"LayerArn": "arn:aws:lambda:eu-west-1:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2",
"LayerVersionArn": "arn:aws:lambda:eu-west-1:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:29",
"Description": "Powertools for AWS Lambda (TypeScript) version 2.18.0",
"CreatedDate": "2025-04-08T07:38:30.424+0000",
"Version": 24,
"CompatibleRuntimes": [
"nodejs18.x",
"nodejs20.x",
"nodejs22.x"
],
"LicenseInfo": "MIT-0",
"CompatibleArchitectures": [
"arm64",
"x86_64"
]
}
```

### How to use with Infrastructure as Code

Expand Down Expand Up @@ -341,3 +346,20 @@ aws lambda get-layer-version-by-arn --arn arn:aws:lambda:{aws::region}:094274105
},
});
```

### Dependency management

When using the Lambda Layer, the Powertools for AWS Lambda packages are already included in your Lambda runtime environment. However, you still need to [install these packages](./installation.md) locally for development, testing, and IDE support.

Since the packages are provided by the Lambda Layer at runtime, install them as `devDependencies` in your `package.json` file:

```bash title="Install Powertools for AWS Lambda packages"
npm i -D @aws-lambda-powertools/logger
```

**Important considerations:**

- **Exclude from bundling**: Ensure your build process excludes these packages from your deployment bundle since they're provided by the layer
- **Version synchronization**: Keep your local development dependencies in sync with the Lambda Layer version to maintain consistency

Following these practices prevents version conflicts that can cause unexpected behavior, such as failed `instanceof` checks or inconsistent behavior between your local development environment and the Lambda execution environment.