Skip to content

Commit 4d5f6ca

Browse files
authored
Merge branch 'main' into feat/metrics_custom_logger
2 parents 152ecee + db26958 commit 4d5f6ca

File tree

25 files changed

+924
-878
lines changed

25 files changed

+924
-878
lines changed

docs/core/tracer.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ Tracer exposes a `getRootXrayTraceId()` method that allows you to retrieve the [
378378

379379
### Escape hatch mechanism
380380

381-
You can use `tracer.provider` attribute to access all methods provided by the [AWS X-Ray SDK](https://docs.aws.amazon.com/xray-sdk-for-nodejs/latest/reference/AWSXRay.html).
381+
You can use `tracer.provider` attribute to access [a subset of the methods provided](https://docs.powertools.aws.dev/lambda/typescript/latest/api/classes/_aws_lambda_powertools_tracer.provider_ProviderService.ProviderService.html) by the [AWS X-Ray SDK](https://docs.aws.amazon.com/xray-sdk-for-nodejs/latest/reference/AWSXRay.html).
382382

383383
This is useful when you need a feature available in X-Ray that is not available in the Tracer utility, for example [SQL queries tracing](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-sqlclients.html), or [a custom logger](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-configuration.html#xray-sdk-nodejs-configuration-logging).
384384

@@ -388,6 +388,8 @@ This is useful when you need a feature available in X-Ray that is not available
388388
--8<-- "examples/snippets/tracer/escapeHatch.ts"
389389
```
390390

391+
If you need to access a method that is not available you can import it directly from the AWS X-Ray SDK for Node.js. Compatibility with the Tracer utility is not guaranteed.
392+
391393
## Testing your code
392394

393395
Tracer is disabled by default when not running in the AWS Lambda environment - This means no code changes or environment variables to be set.

docs/utilities/idempotency.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ Similar to the `makeIdempotent` function wrapper, you can quickly make your Lamb
206206
--8<-- "examples/snippets/idempotency/types.ts:3:16"
207207
```
208208

209+
For the middleware to work, your Lambda function handler must return a value different from `undefined`. This is a [known limitation of the early return feature in Middy.js](https://github.com/middyjs/middy/issues/1236). If your use case requires early returns, you can use the `makeIdempotent` function wrapper instead.
210+
209211
### Choosing a payload subset for idempotency
210212

211213
Use [`IdempotencyConfig`](#customizing-the-default-behavior) to instruct the idempotent decorator to only use a portion of your payload to verify whether a request is idempotent, and therefore it should not be retried. When dealing with a more elaborate payload, where parts of the payload always change, you should use the **`eventKeyJmesPath`** parameter.

examples/app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"devDependencies": {
3131
"@types/aws-lambda": "^8.10.145",
3232
"@types/node": "22.5.4",
33-
"aws-cdk": "^2.157.0",
34-
"aws-cdk-lib": "^2.157.0",
33+
"aws-cdk": "^2.158.0",
34+
"aws-cdk-lib": "^2.158.0",
3535
"constructs": "^10.3.0",
3636
"source-map-support": "^0.5.21",
3737
"tsx": "^4.19.0",

layers/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"source-map-support": "^0.5.21"
3737
},
3838
"dependencies": {
39-
"aws-cdk": "^2.157.0",
40-
"aws-cdk-lib": "^2.157.0",
39+
"aws-cdk": "^2.158.0",
40+
"aws-cdk-lib": "^2.158.0",
4141
"esbuild": "^0.23.1"
4242
}
4343
}

package-lock.json

Lines changed: 233 additions & 333 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050
},
5151
"homepage": "https://github.com/aws-powertools/powertools-lambda-typescript#readme",
5252
"devDependencies": {
53-
"@biomejs/biome": "^1.8.3",
53+
"@biomejs/biome": "^1.9.0",
5454
"@types/aws-lambda": "^8.10.145",
5555
"@types/jest": "^29.5.12",
5656
"@types/node": "^22.5.4",
57-
"@vitest/coverage-v8": "^2.0.5",
57+
"@vitest/coverage-v8": "^2.1.0",
5858
"husky": "^9.1.6",
5959
"jest": "^29.7.0",
6060
"jest-runner-groups": "^2.2.0",

packages/idempotency/src/middleware/makeHandlerIdempotent.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { IdempotencyHandler } from '../IdempotencyHandler.js';
2-
import { IdempotencyConfig } from '../IdempotencyConfig.js';
31
import {
4-
cleanupMiddlewares,
52
IDEMPOTENCY_KEY,
3+
cleanupMiddlewares,
64
} from '@aws-lambda-powertools/commons';
75
import type {
8-
AnyFunction,
9-
IdempotencyLambdaHandlerOptions,
10-
} from '../types/IdempotencyOptions.js';
11-
import type {
6+
JSONValue,
127
MiddlewareLikeObj,
138
MiddyLikeRequest,
14-
JSONValue,
159
} from '@aws-lambda-powertools/commons/types';
10+
import { IdempotencyConfig } from '../IdempotencyConfig.js';
11+
import { IdempotencyHandler } from '../IdempotencyHandler.js';
12+
import type {
13+
AnyFunction,
14+
IdempotencyLambdaHandlerOptions,
15+
} from '../types/IdempotencyOptions.js';
1616

1717
/**
1818
* @internal
@@ -90,6 +90,11 @@ const shouldSkipIdempotency = (request: MiddyLikeRequest): boolean => {
9090
* ).use(makeHandlerIdempotent({ persistenceStore: dynamoDBPersistenceLayer }));
9191
* ```
9292
*
93+
* For the middleware to work, your Lambda function handler must return a value different from `undefined`.
94+
* This is a [known limitation of the early return feature in Middy.js](https://github.com/middyjs/middy/issues/1236).
95+
*
96+
* If your use case requires early returns, you can use the {@link index.makeIdempotent | makeIdempotent()} function wrapper instead.
97+
*
9398
* @param options - Options for the idempotency middleware
9499
*/
95100
const makeHandlerIdempotent = (

0 commit comments

Comments
 (0)