Skip to content

Commit b2b15a3

Browse files
committed
fix
1 parent 9121468 commit b2b15a3

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/infra/docs-lambda-index-publisher/Program.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,13 @@
1717
const string bucketName = "elastic-docs-link-index";
1818
const string indexFile = "link-index-test.json";
1919

20-
await LambdaBootstrapBuilder.Create<SQSEvent>(Handler, new SourceGeneratorLambdaJsonSerializer<LinkIndexUpdaterSerializerContext>())
20+
await LambdaBootstrapBuilder.Create<SQSEvent, SQSBatchResponse>(Handler, new SourceGeneratorLambdaJsonSerializer<LinkIndexUpdaterSerializerContext>())
2121
.Build()
2222
.RunAsync();
2323

2424
return;
2525

26-
// This function should return SQSBatchResponse but for some reason
27-
// it's not working as expected.
28-
// The partial batch response might not be serialized correctly.
29-
// However, serializing the response to JSON and returning it as string works.
30-
static async Task<string> Handler(SQSEvent ev, ILambdaContext context)
26+
static async Task<SQSBatchResponse> Handler(SQSEvent ev, ILambdaContext context)
3127
{
3228
var s3Client = new AmazonS3Client();
3329
var batchItemFailures = new List<SQSBatchResponse.BatchItemFailure>();
@@ -87,7 +83,8 @@ static async Task<string> Handler(SQSEvent ev, ILambdaContext context)
8783
context.Logger.LogInformation($"Failed to process {batchItemFailures.Count} messages. Returning them to the queue.");
8884
context.Logger.LogInformation(jsonString);
8985
}
90-
return jsonString;
86+
87+
return response;
9188
}
9289
catch (Exception ex)
9390
{
@@ -105,7 +102,7 @@ static async Task<string> Handler(SQSEvent ev, ILambdaContext context)
105102
}).ToList());
106103
var jsonString = JsonSerializer.Serialize(response, LinkIndexUpdaterSerializerContext.Default.SQSBatchResponse);
107104
context.Logger.LogInformation(jsonString);
108-
return jsonString;
105+
return response;
109106
}
110107
}
111108

src/infra/docs-lambda-index-publisher/docs-lambda-index-publisher.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,3 @@
3131
<ProjectReference Include="..\..\Elastic.Markdown\Elastic.Markdown.csproj"/>
3232
</ItemGroup>
3333
</Project>
34-

0 commit comments

Comments
 (0)