2323
2424return ;
2525
26- static async Task < SQSBatchResponse > Handler ( SQSEvent ev , ILambdaContext context )
26+ static async Task < string > Handler ( SQSEvent ev , ILambdaContext context )
2727{
2828 var s3Client = new AmazonS3Client ( ) ;
2929 var batchItemFailures = new List < SQSBatchResponse . BatchItemFailure > ( ) ;
@@ -77,12 +77,13 @@ static async Task<SQSBatchResponse> Handler(SQSEvent ev, ILambdaContext context)
7777 context . Logger . LogInformation ( $ "Successfully updated { bucketName } /{ indexFile } .") ;
7878 context . Logger . LogInformation ( $ "Processed { processedMessageCount } messages.") ;
7979 var response = new SQSBatchResponse ( batchItemFailures ) ;
80+ var jsonString = JsonSerializer . Serialize ( response , LinkIndexUpdaterSerializerContext . Default . SQSBatchResponse ) ;
8081 if ( batchItemFailures . Count > 0 )
8182 {
8283 context . Logger . LogInformation ( $ "Failed to process { batchItemFailures . Count } messages. Returning them to the queue.") ;
83- context . Logger . LogInformation ( JsonSerializer . Serialize ( response , LinkIndexUpdaterSerializerContext . Default . SQSBatchResponse ) ) ;
84+ context . Logger . LogInformation ( jsonString ) ;
8485 }
85- return response ;
86+ return jsonString ;
8687 }
8788 catch ( Exception ex )
8889 {
@@ -98,8 +99,9 @@ static async Task<SQSBatchResponse> Handler(SQSEvent ev, ILambdaContext context)
9899 {
99100 ItemIdentifier = r . MessageId
100101 } ) . ToList ( ) ) ;
101- context . Logger . LogInformation ( JsonSerializer . Serialize ( response , LinkIndexUpdaterSerializerContext . Default . SQSBatchResponse ) ) ;
102- return response ;
102+ var jsonString = JsonSerializer . Serialize ( response , LinkIndexUpdaterSerializerContext . Default . SQSBatchResponse ) ;
103+ context . Logger . LogInformation ( jsonString ) ;
104+ return jsonString ;
103105 }
104106}
105107
0 commit comments