Feature request : being able to customize handler resolution
I've been trying to use your plugin but my setup involves Instana (a log analyzer vendor). The @instana/serverless module works this way :
- You must add an instana
layerthat provides the libraries - You change the handler to an instana handler provided by the layer
- You provide the 'real' handler to the instana layer in an env variable.
So the lambda looks like this :
Login:
handler: instana-aws-lambda-auto-wrap.handler
environment:
LAMBDA_HANDLER: src/handlers/Login.handler
layers:
- arn:aws:lambda:eu-west-1:410797082306:layer:instana-nodejs:38
When using serverless-esbuild this breaks handler resolution. I've been able to make it work by forking the module and replacing this line : https://github.com/floydspace/serverless-esbuild/blob/65b7431aca4bfe5b8f85bd1aecf8d6c1b9fc050b/src/helper.ts#L36-L37
with
return Object.values(functions)
.map(fn => (fn.environment && fn.environment.LAMBDA_HANDLER) || fn.handler)
Of course, this is very specific, so I wonder if you could add a way of providing this in the configuration or overriding the extractFileNames function, as you already provide a special behavior for the google provider.
If you're ok or have an idea about how it should be implemented, I may be able to submit a PR.
Thanks
Hi @wimpheling, thank you for the request, we will consider this if we get more requests.
For now, I recommend using patch-package, it's a nice package to keep your patches to node_modules shared. so you do not have to make a fork or whatever.
@wimpheling did @floydspace's recommendation worked for you ? Can we close this ?
Support for the Instana lambda layer would be a great enhancement for us. Serverless-Webpack allows this now by letting you set a different entrypoint for each lambda function.