I have created a lambda function that relies on some dependencies in a node_modules folder.
I had originally created the lambda with a node_modules folder inside of it, and it worked fine when testing.
I then created a layer, uploaded the node_modules folder to it, and set the runtime to Node.js 8.10.
I then added the layer to the lambda, created a policy with the following JSON, and added the policy to the role associated with the lambda:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "lambda:GetLayerVersion",
"Resource": "*"
}
]
}
When I test the Lambda, then dependencies that I am trying to include from the node_modules folder located within the associated layer are not found.
Update:
I've also run the following command:
aws lambda add-layer-version-permission --layer-name node_modules --version-number 2 \ --statement-id publish --action lambda:GetLayerVersion --principal "*"
But the problem has not been resolved.