Questions tagged [aws-lambda-layers]
382 questions
33
votes
4 answers
Import libraries in lambda layers
I wanted to import jsonschema library in my AWS Lambda in order to perform request validation. Instead of bundling the dependency with my app , I am looking to do this via Lambda Layers. I zipped all the dependencies under…

Punter Vicky
- 15,954
- 56
- 188
- 315
30
votes
7 answers
"Runtime.ImportModuleError" trying to access npm package in an AWS lambda function using layers
I'd like to use the npm package "request" in an AWS lambda function.
I'm trying to follow the procedure outlined in this article here: https://medium.com/@anjanava.biswas/nodejs-runtime-environment-with-aws-lambda-layers-f3914613e20e
I've created a…

kshetline
- 12,547
- 4
- 37
- 73
20
votes
4 answers
Unable to import module 'lambda_function': No module named 'pandas'
START RequestId: 3d5691d9-ad79-4eed-a26c-5bc3f1a23a99 Version: $LATEST
Unable to import module 'lambda_function': No module named 'pandas'
END RequestId: 3d5691d9-ad79-4eed-a26c-5bc3f1a23a99
I'm using Windows 7 64-bit as the host OS.
What I…

mnm
- 1,962
- 4
- 19
- 46
16
votes
2 answers
AWS lambda layers error when call API "cannot find module"
I try to use layers of AWS Lambda, watched a tutorial about it, but I get an error "cannot find module ..."
service: aws-nodejs
package:
exclude:
- .gitignore
- package.json
- .git/**
provider:
name: aws
profile: sandbox
…

dc-mpo
- 353
- 1
- 2
- 10
13
votes
3 answers
Is it a good idea to use Python SQLAlchemy in AWS Lambda?
Amazon suggests to not include big libraries/dependencies in lambda functions.
As far as I know, SQLAlchemy is quite a big python library. Do you think it is a good idea to use it in lambda functions? An option would be to include it as a Lambda…

funtik
- 1,688
- 3
- 11
- 27
12
votes
2 answers
Test an AWS lambda locally using Docker container image
i have been having a hard time getting this thing to work right
i am trying to invoke the Lambda locally which is running on docker container but i have following issue
Docker File
FROM public.ecr.aws/lambda/python:3.8
COPY myfunction.py ./
CMD…

Soumil Nitin Shah
- 634
- 2
- 7
- 18
12
votes
2 answers
Are old AWS Lambda layers automatically removed? If not, how to delete them?
Upon reading of this article which discusses the main drawback of using AWS Lambda functions, I'm trying to avoid what the author had to deal with and perform some cleanup on my own code:
"Lambda versions every function. We use the Serverless…

avazula
- 472
- 1
- 6
- 23
11
votes
4 answers
AWS: Delete lambda layer still retains layer version history
I am deploying a AWS Lambda layer using aws cli:
aws lambda publish-layer-version --layer-name my_layer --zip-file fileb://my_layer.zip
I delete it using
VERSION=$(aws lambda list-layer-versions --layer-name my_layer | jq…

cloud jockey
- 248
- 3
- 15
10
votes
3 answers
Configure AWS Lambda function to use latest version of a Layer
I have more than 20 lambda functions in a developing application. And a lambda layer that contains a good amount of common code.
A Lambda function, is hook it to a particular version of the layer, and every time I update a layer, it generates a new…

Vikas
- 626
- 1
- 10
- 22
10
votes
1 answer
Can I import typescript types from a Lambda Layer?
I am attempting to use TypeScript when building Lambda functions but hitting an issue when using a Lambda Layer which is also written in TypeScript.
TypeScript does not recognise the /opt/nodejs/... import for my Layer (as it would running in SAM…

user3067870
- 556
- 1
- 6
- 17
10
votes
3 answers
Latest Lambda Layer ARN
I have a lambda layer which I keep updating. This lambda layer has multiple versions. How can I find the lambda layer ARN with latest version using aws cli?

Punter Vicky
- 15,954
- 56
- 188
- 315
9
votes
1 answer
How configure Visual Studio Code to resolve input paths for AWS Lambda Layers (javascript)
I use VS Code for development of my AWS hosted serverless application.
The app uses Lambdas. Recently, I've decided to start using Lambda Layers to extract and reuse common code.
The problem that I have is that AWS Lambda expects the following…

Arsenii Fomin
- 3,120
- 3
- 22
- 42
9
votes
5 answers
SAM build - does it also build layers?
I'm new to both lambda's and also SAM - so if I've screwed anything simple up don't yell :D.
Summary: I can't get sam build to build a layer specified in template.yaml, it only builds the lambda function.
Background: I'm trying to build a lambda…

Richard
- 3,024
- 2
- 17
- 40
8
votes
2 answers
How to make ES modules import from a Lambda layer work?
I have a lambda function in node v14 that imports AWS SDK v3 from a lambda layer.
In my function I can use my node modules from the layer only if I use CommonJS syntax:
const { parseUrl } = require('@aws-sdk/url-parser');
Using ES modules doesn't…

Šimon Kvasnička
- 81
- 1
- 4
8
votes
1 answer
Finding an equivalent of environment variables in AWS Lambda Layers?
I am writing a serverless app on AWS.
I have broken up the app into many CloudFormation stacks. I am using CDK (in Python) to create the CF stacks to deploy the app.
A core requirement of my lambda functions, of course, is the ability to log events.…

Nevo
- 752
- 2
- 9
- 22