Skip to content

Commit a9e06fb

Browse files
committed
ok
1 parent 082274e commit a9e06fb

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

src/api/Elastic.Documentation.Api.Lambda/Elastic.Documentation.Api.Lambda.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Amazon.Lambda.AspNetCoreServer.Hosting"/>
3130
<PackageReference Include="Elastic.OpenTelemetry" />
3231
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" />
3332
</ItemGroup>

src/api/Elastic.Documentation.Api.Lambda/Program.cs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5-
using System.Text.Json.Serialization;
6-
using Amazon.Lambda.APIGatewayEvents;
7-
using Amazon.Lambda.Serialization.SystemTextJson;
8-
using Elastic.Documentation.Api.Core.AskAi;
9-
using Elastic.Documentation.Api.Core.Search;
105
using Elastic.Documentation.Api.Infrastructure;
116
using Elastic.Documentation.ServiceDefaults;
127
using Microsoft.Extensions.Logging;
@@ -53,9 +48,14 @@
5348
process.Refresh();
5449
Console.WriteLine($"Elastic OTel configured. Memory: {process.WorkingSet64 / 1024 / 1024} MB");
5550

56-
_ = builder.Services.AddAWSLambdaHosting(LambdaEventSource.HttpApi, new SourceGeneratorLambdaJsonSerializer<LambdaJsonSerializerContext>());
51+
// Configure Kestrel to listen on port 8080 for Lambda Web Adapter
52+
// Lambda Web Adapter expects the app to run as a standard HTTP server on localhost:8080
53+
_ = builder.WebHost.ConfigureKestrel(serverOptions =>
54+
{
55+
serverOptions.ListenLocalhost(8080);
56+
});
5757
process.Refresh();
58-
Console.WriteLine($"AWS Lambda hosting configured. Memory: {process.WorkingSet64 / 1024 / 1024} MB");
58+
Console.WriteLine($"Kestrel configured to listen on port 8080. Memory: {process.WorkingSet64 / 1024 / 1024} MB");
5959

6060
var environment = Environment.GetEnvironmentVariable("ENVIRONMENT");
6161
Console.WriteLine($"Environment: {environment}");
@@ -64,10 +64,6 @@
6464
process.Refresh();
6565
Console.WriteLine($"Elastic docs API use cases added. Memory: {process.WorkingSet64 / 1024 / 1024} MB");
6666

67-
_ = builder.WebHost.UseKestrelHttpsConfiguration();
68-
process.Refresh();
69-
Console.WriteLine($"Kestrel HTTPS configuration applied. Memory: {process.WorkingSet64 / 1024 / 1024} MB");
70-
7167
var app = builder.Build();
7268
process.Refresh();
7369
Console.WriteLine($"Application built successfully. Memory: {process.WorkingSet64 / 1024 / 1024} MB");
@@ -86,10 +82,3 @@
8682
Console.WriteLine($"Stack trace: {ex.StackTrace}");
8783
throw;
8884
}
89-
90-
[JsonSerializable(typeof(APIGatewayHttpApiV2ProxyRequest))]
91-
[JsonSerializable(typeof(APIGatewayHttpApiV2ProxyResponse))]
92-
[JsonSerializable(typeof(AskAiRequest))]
93-
[JsonSerializable(typeof(SearchRequest))]
94-
[JsonSerializable(typeof(SearchResponse))]
95-
internal sealed partial class LambdaJsonSerializerContext : JsonSerializerContext;

0 commit comments

Comments
 (0)