I followed the example repo found here. The function deploys without issue however it does not have a layer attached per the Lambda console. I can manually add the layer from the console after the function has deployed. sls deploy -v doesn’t complain about anything. Any help is appreciated.
The example from that repo you referenced doesn’t look valid. Also I don’t see your layers property in your serverless.yml file.
I’ve got it working with serverless.yml:
layers:
test:
path: layer # path of the dir you're expecting to import stuff from.
name: ${self:provider.stage}-layerName
description: Description of what the lambda layer does
compatibleRuntimes:
- nodejs8.10
allowedAccounts:
- ${self:provider.accountId}
retain: true
and then my lambda function has a property of “layers” as well, like. You can reference the lambda layer by name case sensitive (e.g. Test, not test) appended with “LambdaLayer”: