File tree 3 files changed +5
-12
lines changed
3 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class AsyncBatchProcessor extends BasePartialBatchProcessor {
10
10
) : Promise < SuccessResponse | FailureResponse > {
11
11
try {
12
12
const data = this . toBatchType ( record , this . eventType ) ;
13
- const result = await this . handler ( data , this . options ) ;
13
+ const result = await this . handler ( data , this . options ?. context ) ;
14
14
15
15
return this . successHandler ( record , result ) ;
16
16
} catch ( error ) {
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class BatchProcessor extends BasePartialBatchProcessor {
19
19
public processRecord ( record : BaseRecord ) : SuccessResponse | FailureResponse {
20
20
try {
21
21
const data = this . toBatchType ( record , this . eventType ) ;
22
- const result = this . handler ( data , this . options ) ;
22
+ const result = this . handler ( data , this . options ?. context ) ;
23
23
24
24
return this . successHandler ( record , result ) ;
25
25
} catch ( error ) {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import type {
3
3
KinesisStreamRecord ,
4
4
SQSRecord ,
5
5
} from 'aws-lambda' ;
6
- import type { BatchProcessingOptions } from '../../src/types ' ;
6
+ import type { Context } from 'aws-lambda ' ;
7
7
8
8
const sqsRecordHandler = ( record : SQSRecord ) : string => {
9
9
const body = record . body ;
@@ -63,12 +63,7 @@ const asyncDynamodbRecordHandler = async (
63
63
return body ;
64
64
} ;
65
65
66
- const handlerWithContext = (
67
- record : SQSRecord ,
68
- options : BatchProcessingOptions
69
- ) : string => {
70
- const context = options . context ;
71
-
66
+ const handlerWithContext = ( record : SQSRecord , context : Context ) : string => {
72
67
try {
73
68
if ( context . getRemainingTimeInMillis ( ) == 0 ) {
74
69
throw Error ( 'No time remaining.' ) ;
@@ -82,10 +77,8 @@ const handlerWithContext = (
82
77
83
78
const asyncHandlerWithContext = async (
84
79
record : SQSRecord ,
85
- options : BatchProcessingOptions
80
+ context : Context
86
81
) : Promise < string > => {
87
- const context = options . context ;
88
-
89
82
try {
90
83
if ( context . getRemainingTimeInMillis ( ) == 0 ) {
91
84
throw Error ( 'No time remaining.' ) ;
You can’t perform that action at this time.
0 commit comments