Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions docs/features/kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ When processing large Kafka messages in Lambda, be mindful of memory limitations

=== "Handling Large Messages"

```typescript hl_lines="18-20"
--8<-- "examples/snippets/kafka/advancedHandlingLargeMessages.ts:6"
```typescript hl_lines="22-23"
--8<-- "examples/snippets/kafka/advancedHandlingLargeMessages.ts:9"
```

For large messages, consider these proven approaches:
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/batch/extendingFailure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
FailureResponse,
} from '@aws-lambda-powertools/batch/types';
import { Logger } from '@aws-lambda-powertools/logger';
import { MetricUnit, Metrics } from '@aws-lambda-powertools/metrics';
import { Metrics, MetricUnit } from '@aws-lambda-powertools/metrics';
import type { SQSHandler, SQSRecord } from 'aws-lambda';

class MyProcessor extends BatchProcessor {
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/batch/gettingStartedSQSFifo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
SqsFifoPartialProcessorAsync,
processPartialResponse,
SqsFifoPartialProcessorAsync,
} from '@aws-lambda-powertools/batch';
import { Logger } from '@aws-lambda-powertools/logger';
import type { SQSHandler, SQSRecord } from 'aws-lambda';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
SqsFifoPartialProcessorAsync,
processPartialResponse,
SqsFifoPartialProcessorAsync,
} from '@aws-lambda-powertools/batch';
import { Logger } from '@aws-lambda-powertools/logger';
import type {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppSyncEventsResolver } from '@aws-lambda-powertools/event-handler/appsync-events';
import { MetricUnit, Metrics } from '@aws-lambda-powertools/metrics';
import { Metrics, MetricUnit } from '@aws-lambda-powertools/metrics';
import type { Context } from 'aws-lambda';

const metrics = new Metrics({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppSyncEventsResolver } from '@aws-lambda-powertools/event-handler/appsync-events';
import type { AppSyncEventsSubscribeEvent } from '@aws-lambda-powertools/event-handler/types';
import { MetricUnit, Metrics } from '@aws-lambda-powertools/metrics';
import { Metrics, MetricUnit } from '@aws-lambda-powertools/metrics';
import type { Context } from 'aws-lambda';

const metrics = new Metrics({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"error": "Error - An unexpected error occurred"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"sampling_rate": 0,
"xray_trace_id": "1-68079892-6a1723770bc0b1f348d9a7ad"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"id": "2"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"id": "2"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
"info": {
"channel": {
"path": "/default/channel",
"segments": [
"default",
"channel"
]
"segments": ["default", "channel"]
},
"channelNamespace": {
"name": "default"
Expand All @@ -39,4 +36,4 @@
"id": "2"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"id": "2"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"id": "2"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"info": {
"channel": {
"path": "/default/foo",
"segments": [
"default",
"foo"
]
"segments": ["default", "foo"]
},
"channelNamespace": {
"name": "default"
Expand Down Expand Up @@ -44,4 +41,4 @@
"id": "8bb2983a-0967-45a0-8243-0aeb8c83d80e"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"info": {
"channel": {
"path": "/default/bar",
"segments": [
"default",
"bar"
]
"segments": ["default", "bar"]
},
"channelNamespace": {
"name": "default"
Expand All @@ -25,4 +22,4 @@
"stash": {},
"outErrors": [],
"events": null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
"correlation_id": "Root=1-68653697-3623822a02e171272e2ecfe4",
"id": "42"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ type Merchant {
name: String!
description: String
locations: [Location]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ type Todo {
userId: String
title: String
completed: Boolean
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ app.tool<{ city: string }>(
async ({ city }, { event }) => {
try {
throw new Error('Simulated error for demonstration purposes');
} catch (error) {
} catch (_error) {
const {
sessionAttributes,
promptSessionAttributes,
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/getting-started/patterns-middyjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export const handler = middy()
.use(captureLambdaHandler(tracer))
.use(injectLambdaContext(logger))
.use(logMetrics(metrics))
.handler(async (event: unknown) => {
.handler(async (_event: unknown) => {
// Your business logic here
});
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CustomPersistenceLayer extends BasePersistenceLayer {
return new IdempotencyRecord({
...(item as unknown as IdempotencyRecordOptions),
});
} catch (error) {
} catch (_error) {
throw new IdempotencyItemNotFoundError();
}
}
Expand All @@ -64,7 +64,7 @@ class CustomPersistenceLayer extends BasePersistenceLayer {

const ttl = record.expiryTimestamp
? Math.floor(new Date(record.expiryTimestamp * 1000).getTime() / 1000) -
Math.floor(new Date().getTime() / 1000)
Math.floor(Date.now() / 1000)
: this.getExpiresAfterSeconds();

let existingItem: ProviderItem | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const handler = async (
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
};
4 changes: 2 additions & 2 deletions examples/snippets/idempotency/customKeyPrefixDecorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Lambda {
persistenceStore,
keyPrefix: 'createSubscriptionPayment',
})
async handler(event: unknown, context: Context) {
async handler(_event: unknown, _context: Context) {
try {
// ... create payment

Expand All @@ -21,7 +21,7 @@ class Lambda {
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/customKeyPrefixFnWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const handler = makeIdempotent(
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
},
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/customKeyPrefixMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const handler = middy()
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
});
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/customizePersistenceLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const handler = middy(
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/makeHandlerIdempotent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const handler = middy(
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/makeIdempotentAnyFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const handler = async (
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
};
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/makeIdempotentBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const handler = makeIdempotent(
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
},
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/makeIdempotentJmes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const handler = makeIdempotent(
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const handler = async (
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"message": "success",
"paymentId": "31a964eb-7477-4fe1-99fe-7f8a6a351a7e",
"statusCode": 200,
"headers": {
"x-idempotency-key": "function-name#mHfGv2vJ8h+ZvLIr/qGBbQ=="
}
}
"message": "success",
"paymentId": "31a964eb-7477-4fe1-99fe-7f8a6a351a7e",
"statusCode": 200,
"headers": {
"x-idempotency-key": "function-name#mHfGv2vJ8h+ZvLIr/qGBbQ=="
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"user": "John Doe",
"productId": "123456"
}
"user": "John Doe",
"productId": "123456"
}
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/workingWithCompositeKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const handler = middy(
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/workingWithCustomClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const handler = makeIdempotent(
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
},
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/workingWithCustomConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const handler = makeIdempotent(
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
},
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/workingWithExceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const handler = async (
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const handler = makeIdempotent(
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
},
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/workingWithLocalCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const handler = middy(
message: 'success',
statusCode: 200,
};
} catch (error) {
} catch (_error) {
throw new Error('Error creating payment');
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/idempotency/workingWithLocalDynamoDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const ddbPersistenceStore = new DynamoDBPersistenceLayer({
tableName: 'IdempotencyTable',
});

const handler = async (event: unknown, context: Context) => {
const handler = async (_event: unknown, _context: Context) => {
return {
statusCode: 200,
body: JSON.stringify({
Expand Down
Loading