File tree Expand file tree Collapse file tree 3 files changed +5
-12
lines changed Expand file tree Collapse file tree 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 {
1010 ) : Promise < SuccessResponse | FailureResponse > {
1111 try {
1212 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 ) ;
1414
1515 return this . successHandler ( record , result ) ;
1616 } catch ( error ) {
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class BatchProcessor extends BasePartialBatchProcessor {
1919 public processRecord ( record : BaseRecord ) : SuccessResponse | FailureResponse {
2020 try {
2121 const data = this . toBatchType ( record , this . eventType ) ;
22- const result = this . handler ( data , this . options ) ;
22+ const result = this . handler ( data , this . options ?. context ) ;
2323
2424 return this . successHandler ( record , result ) ;
2525 } catch ( error ) {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import type {
33 KinesisStreamRecord ,
44 SQSRecord ,
55} from 'aws-lambda' ;
6- import type { BatchProcessingOptions } from '../../src/types ' ;
6+ import type { Context } from 'aws-lambda ' ;
77
88const sqsRecordHandler = ( record : SQSRecord ) : string => {
99 const body = record . body ;
@@ -63,12 +63,7 @@ const asyncDynamodbRecordHandler = async (
6363 return body ;
6464} ;
6565
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 => {
7267 try {
7368 if ( context . getRemainingTimeInMillis ( ) == 0 ) {
7469 throw Error ( 'No time remaining.' ) ;
@@ -82,10 +77,8 @@ const handlerWithContext = (
8277
8378const asyncHandlerWithContext = async (
8479 record : SQSRecord ,
85- options : BatchProcessingOptions
80+ context : Context
8681) : Promise < string > => {
87- const context = options . context ;
88-
8982 try {
9083 if ( context . getRemainingTimeInMillis ( ) == 0 ) {
9184 throw Error ( 'No time remaining.' ) ;
You can’t perform that action at this time.
0 commit comments