dherault / serverless-offline

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

Use same serverless-offline instance for many projects or monorepo app #1663

Open throrin19 opened 1 year ago

throrin19 commented 1 year ago

Feature Request

It's possible to add the possibility to use the same serverless instance tu run many projects inside the same API Gateway proxy ? (same port).

In our case we migrate a big monolitic app to a monorepo approach and we need to use the same serverless instance between the old and the new repo.

We also need this to use same apigateway between all monorepo projects (many projects can use HTTP apigateway as source)

Actually, If we would do that, we have to set different port between all projects (lambdaPort and httpPort). It's not acceptable to develop it easilly with the Front project and it complexifie that only for the local dev part.

For example, the plugin serverless-offline-aws-eventbridge use that with this configuration :

custom:
  serverless-offline-aws-eventbridge:
    port: 4010 # port to run the eventBridge mock server on
    mockEventBridgeServer: true # Set to false if EventBridge is already mocked by another stack

With that, all projects can use the same eventBridge mock part. I know, it's not the same logic as serverless-offline but if you do this, it will be awersome for many users

throrin19 commented 1 year ago

After research, I found serverless-compose but serverless offline is not compatible with it. I made an issue to ask about a possible compatibility to add this feature request. (Issue here : https://github.com/serverless/compose/issues/175)

Unfortunately, since serverless-offline is not part of the serverless core, the compose team cannot do anything.

I found a "pseudo" solution available here but it is not clean at all: https://github.com/dherault/serverless-offline/issues/1386#issuecomment-1463432863