softwaremill / tapir

Rapid development of self-documenting APIs
https://tapir.softwaremill.com
Apache License 2.0
1.36k stars 419 forks source link

[BUG] AWS Lambda handler hardcodes ServerOptions #4064

Open cakper opened 1 month ago

cakper commented 1 month ago

Tapir version: latest in master

Scala version: 3.5.1

Hello,

I was trying to configure CORS for lambda handler and couldn't get it to work by overriding serverOptions when extending AwsLambdaIORuntime. I believe the issue is that in LambdaHandler when process is called, then default no encoding options are used: https://github.com/softwaremill/tapir/blob/master/serverless/aws/lambda-cats-effect/src/main/scala/sttp/tapir/serverless/aws/lambda/LambdaHandler.scala#L28

How to reproduce?

Create AwsLambdaIORuntime and pass any interceptor to it, run the code - it doesn't get called.


I might give fixing it a go, if I get a bit of guidance at to what solution you would prefer

adamw commented 1 month ago

Indeed that's a bug. I think following what other interpreters do, that is - allow defining custom server options and using those - is what we should be after. If you could work on a PR, that would be great :)