dherault / serverless-offline

Emulate AWS λ and API Gateway locally when developing your Serverless project
MIT License
5.19k stars 796 forks source link

[Support] Help supporting Swift Lambda with a SwiftRunner please! #1673

Open darylteo opened 1 year ago

darylteo commented 1 year ago

Feature Request

https://github.com/serverless/serverless/issues/11840

I'm currently trying to pull in a Swift lambda into SLS, which I am currently able to get a local running server out of the box using Swift Lambda Runtime.

How do I extend Serverless Offline to proxy invocations for my swift function to this server so that it can respond to invocations?

I'm staring at these files and it does not seem extensible :)

https://github.com/dherault/serverless-offline/blob/56d986b672602b3600fe9b552ecb4ee392ca2201/src/lambda/LambdaFunction.js

https://github.com/dherault/serverless-offline/blob/43dfea4fc97f57d439186523ab5e7b3bc3770e55/src/lambda/handler-runner/HandlerRunner.js

Edit: I do see some effort in the codebase with the supportedProvided set of runtimes provided and provided.al2. I assume there might be some future consideration here? I can't see it being used elsewhere though. Updated my proposal below to align.


Proposed Solution

Option 1:

maybe a extension property in serverless.yml like the following

functions: 
  swift-function:
    handler: src/index.handler
    runtime: 'provided'
    offline: 
      proxy: 'localhost:7000/invoke'

or maybe configuration in the custom property

custom:
  offline: 
    runtimes: 
      swift:
        proxy: 'localhost:7000/invoke'

functions: 
  swift-function:
    handler: src/index.handler
    runtime: 'swift'

Option 2:

Or just simply a new Runner maintained by your team

Option 3:

or maybe a facility for adding custom runners for other plugins?

Option 4:

or expose some hooks?