Open kenhks opened 2 years ago
The issues above I managed to workaround by just adding the layer to each function, like:
functions:
myFun:
handler: src/serverless.myFun
layers:
- {MyLayerArn}
Would be great though to be able to be able to add my layer only on provider level and done.
And, very important, I think this issue also creates conflicts with other plugins, in my case serverless-layers
, see config below, serverless layers doesn't really need any configuration. As soon as I remove lambda insights its working as expected:
plugins:
modules:
- serverless-plugin-lambda-insights
- serverless-layers
....
custom:
lambdaInsights:
defaultLambdaInsights: true
Ran into the same problem today. If you use any other layers, for example through the serverless-python-requirements plugin (which I expect just about any Python project to use), you run into this problem.
The workaround is also quite inconvenient as you need to do something for every new lambda function you add.
What probably should happen is that instead of adding the layer to each function when defaultLambdaInsights: true
:
Add it to the provider
section layers
.
We're also experiencing this issue when our own defined layers are not being attached, as the lambda insights layer overrides any existing layers attached.
Version Info Serverless: 3.18.1 Serverless-plugin-lambda-insights: 1.5.0
Expected Outcome: func1 has two layers,
layer1
andLambdaInsightsExtension
Actual Result: func1 has only one layer
LambdaInsightsExtension