426 questions
0
votes
1
answer
69
views
AWS Lambda: Runtime.ImportModuleError: /var/task/psycopg2/_psycopg.so: file too short after copying psycopg2 folder
I'm trying to use psycopg2 in an AWS Lambda function (Python 3.11 runtime).
I followed the jkehler/awslambda-psycopg2
repository and copied the psycopg2-3.11 folders directly into my Lambda deployment ...
0
votes
1
answer
197
views
Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'google.generativeai'
I'm trying to use the google-generativeai package in my AWS Lambda function (Python 3.9 runtime). I want to package the dependency as a Lambda Layer, but I'm running into issues.
I followed these ...
1
vote
0
answers
84
views
AWS Lambda Runtime.ImportModuleError
{
"errorMessage": "Unable to import module 'lambda_function': /opt/python/cryptography/hazmat/bindings/_rust.abi3.so: invalid ELF header",
"errorType": "Runtime....
1
vote
0
answers
131
views
AWS Lambda (Node.js) with Sharp Layer still throws error: "Cannot find module 'sharp'"
I'm trying to use the sharp library in my AWS Lambda function (Node.js 22.x) to compress images uploaded via API Gateway. I’ve added sharp as a Lambda Layer and referenced it in my AWS SAM template.
...
0
votes
0
answers
99
views
How can I reference a lambda layer from a lambda function in C# dotnet?
Here is my lambda function:
using Amazon.Lambda.APIGatewayEvents;
using Amazon.Lambda.Core;
using shared;
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson....
0
votes
0
answers
29
views
yarn workspaces for lambda layer - how to only include prod deps in the layer
I am attempting to build a lambda-layer from within a yarn workspace. the basic pattern I am using was inspired by the code at https://github.com/lukehedger/yarn-workspace-lambda-layer.
This is the ...
1
vote
2
answers
88
views
No module named '_typeshed' while using AWS lambda functions
I am creating a chatbot using python, and I was trying to create a API endpoint to get AI responses. I uploaded the code to AWS lambda functions by creating a function and used AWS lambda layers to ...
0
votes
1
answer
119
views
How to add an AWS layer to a function using ARN specification
I am trying to add a predefined layer, but I can't find the AWS console where to do it as indicated by the guide. https://docs.aws.amazon.com/lambda/latest/dg/adding-layers.html.
Can someone please ...
-2
votes
1
answer
101
views
How to get all the aliases of a lambda function using terraform?
How to get all the aliases of a lambda function hosted on a AWS Region (example eu-west-1) using terraform?
0
votes
0
answers
76
views
AWS Lambda with Layer in ts cannot find module in /opt/folder
I'm willing to understand the use of layers in lambdas.
I'm using AWS cloud9 as IDE to sandbox the following tutorial: https://www.cloudtechsimplified.com/aws-lambda-layers/
I wrote a simple function ...
0
votes
0
answers
71
views
Is is good use sqlalchemy in AWS Lambda base project?
We are using only AWS lambda functions to build the entire project. I planned to use sqlalchemy using AWS lambda layers. To do that I followed the example from AWS github repo. Now I'm having trouble ...
2
votes
0
answers
370
views
How to create an AWS Lambda Layer with from requirements.txt?
I'm trying to create an AWS Lambda function that requires several Python packages, specifically OpenCV, NumPy, and MySQL Connector. I want to package these dependencies into a Lambda Layer so that I ...
1
vote
0
answers
71
views
Github Actions fails to build CDK Lambda Layer using Docker
I have some CDK that defines a lambda layer using Code.FromAsset as follows:
const prismaLayer = new LayerVersion(this, "PrismaLayer", {
compatibleRuntimes: [Runtime.NODEJS_18_X],
...
0
votes
0
answers
42
views
Error when importing Rasterio to AWS Lambda
I'm trying to use a rasterio layer in my lambda function but when I try to import rasterio in the code it throws this exception in cloudwatch:
[ERROR] AttributeError: module 'os' has no attribute '...
-1
votes
3
answers
163
views
Unable to load modules using AWS Lambda
I'm trying to run a AWS Lambda function with custom modules (e.g. pyodbc) so I'm using a Layer to include them via a zip file. I was following these tutorials:
https://docs.aws.amazon.com/lambda/...
0
votes
0
answers
188
views
Configuring Opentelemetry for aws lambda leveraging opentelemetry aws lambda layers
I am new to opentelemetry. I am trying to configure zero-code otel instrumentation for aws lambda, so that it could push matrices and traces to SingnalFX.
Implemented lambda using nodejs. I have ...
0
votes
0
answers
127
views
Python layer in lambda via cdk
TL;DR: the requirements.txt file ends up the layer, not the actual modules.
I have a very simple Lambda, created by the cdk.
from aws_cdk import aws_lambda_python_alpha as aws_lambda_python
from ...
0
votes
1
answer
118
views
How to set up a Lambda Layer for Ruby's mysql2 library?
I've been trying to set up a Lambda Layer for my Ruby Lambda function but I can't make it work for some reason.
I've followed AWS' tutorial on creating (https://docs.aws.amazon.com/lambda/latest/dg/...
0
votes
1
answer
208
views
How to add dependency to AWS lambda layer when code is in console, not uploaded
I used pip to install locally and the dependency installed here:
c:\users\info\appdata\local\programs\python\python312\lib\site-packages\my-dependency
I zipped the my-dependency folder and called it ...
0
votes
1
answer
142
views
AT Protocol SDK (atproto) added to Lambda Layer does not work
I have created a zip file with all the libraries on Amazon linux 2023 and uploaded it to LambdaLayer.
mkdir python
pip3.11 install atproto -t python
zip -r python.zip python
I then uploaded that ...
0
votes
1
answer
651
views
Failed to satisfy constraint: Member must satisfy regular expression pattern
I'm trying to follow a simple example from spacy universe layers page, but this is failing for me:
Code Implementation:
# template.yaml file
AWSTemplateFormatVersion: "2010-09-09"
Transform:...
-1
votes
1
answer
445
views
How do i update cfn-response module in CloudFormation stack
I am deploying my Lambda function and getting the below error , I tried to rollback the CloudFromation stack but still getting the same issue .
"CloudFormation did not receive a response from ...
0
votes
1
answer
275
views
Node Js AWS lambda layers code to run locally
I have a code that runs a lambda function and uses lambda layers. The code works as expected in AWS environment.
For simple lambdas i can run the lambda locally by providing the prerequisite 'env' ...
1
vote
0
answers
54
views
Utilizing Python script with large number of dependencies in a Lambda Function
I am attempting to execute a program using an AWS Lambda function with layers and triggers in AWS GovCloud. However, I am facing a memory error during the process of uploading a ZIP file containing ...
1
vote
0
answers
578
views
AWS Lambda : NoSuchModuleError("Can't load plugin: sqlalchemy.dialects:redshift.redshift_connector")
I'm migrating my AWS Lambda Python runtime from 3.8 to 3.11. I'm using AWS Layers to package my dependencies. In my Lambda function, I'm trying to connect to Amazon Redshift using SQLAlchemy. Here are ...
1
vote
2
answers
2k
views
Need help to create an AWS Lambda Layer for Python 3.12 and pyodbc
I'm trying to create an AWS Lambda Layer using Python 3.12 and pyodbc. I've seen a few different sites where they use an older version of Python and, when I try to translate to 3.12, it fails ...
1
vote
1
answer
148
views
How to mock the lambda layer in nodejs
I'm using lambda layer in my lambda function. Since lambda layer code will not be present in the local system, I'm not able mock the layer functions
My code looks like this
// index.mjs
import layer ...
1
vote
1
answer
2k
views
Lambda layer Pandas (numpy) causing dependency error
I have the following Lambda function:
import pandas as pd
def lambda_handler(events, context):
d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
print(df)
I have pandas (and ...
1
vote
0
answers
117
views
Import module error for a Python function in AWS Lambda
Snippet from code:
#!/usr/bin/env python3
import os
import traceback
from jwt import JWT
from botocore.vendored import requests
import time
def lambda_handler(event, context):
app_id = $$$
...
1
vote
0
answers
122
views
AWS Distro for OpenTelemetry Lambda Ignoring traceparent from SQS Trigger Message
I'm using ADOT/OTEL (arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-21-0:1) to generate telemetry for ingestion into Honeycomb from AWS Lambda (Python). On the whole, this ...
1
vote
0
answers
160
views
Running AWS Lambda Python function which requires running JVM
I had some AWS Lambda functions running on Python 3.7 runtime, and my target was to update them to Python 3.11.
They have some functionality (JDBC connections) which requires running JVM on the ...
2
votes
2
answers
878
views
Nodejs ES6 import issue with AWS Lambda & Layer
I'm using NodeJs(ES6) on AWS Lambda with node_module as AWS Layer and I want to publish a message on SNS.
The above code works perfectly with CommonJs syntax but using import syntax (ES6) facing an ...
0
votes
1
answer
207
views
Unable to reproduce python cdk layer zip
My lambda uses requests. I have one package.zip file that works correctly when I deploy using cdk. I've tried multiple things to reproduce the package.zip I have. All of the ways I've tried fail. Once ...
1
vote
0
answers
520
views
How to run Selenium on AWS Lambda with Python versions greater than 3.7
I'm trying to use Selenium with AWS Lambda for web scraping tasks using Python. However, I'm encountering difficulties when trying to run Selenium on Lambda with Python versions greater than 3.7.
...
1
vote
1
answer
1k
views
Terraform aws_lambda_layer_version creates new version for every run
I have a terraform config to create a lambda layer in AWS,
variable "package_name" {
type = string
description = "name of the lambda layer"
default = "google-...
3
votes
1
answer
11k
views
AWS - Lambda - Layers vs. requirements.txt
When setting up a lambda written in python, you can include libraries (json, pymysql, pandas, etc.) either using a requirements.txt file, or by setting up a layer. Does anyone know which option works ...
0
votes
2
answers
412
views
AWS Lambda Layer import Tuya Connector
So all I have for my Lambda Function so far is:
import json
import os
import tuya_connector
And when I click "Test", I'm getting the following error:
"Unable to import module '...
0
votes
1
answer
384
views
Mocking a lambda layer library for unit testing fails in jest
I am trying to unit test my lambda using jest. In the lambda code, we have a line of code that relies on a package situated in the lambda layer.
import { logger } from 'opt/nodejs/logger';
...
logger....
0
votes
2
answers
557
views
Unable to import module 'lambda function': libldap_r-2.4.so.2 cannot open shared objectfile: No such file or directory
I've been dealing with this issue for the past few days now. I am trying to create a lambda layer with the following modules: cryptography, ldap3, and bonsai to use in my lambda_function that has a ...
0
votes
1
answer
141
views
AWS lambda layer code import throwing error while I trying to deploy nodejs serverless project
import { AppConfig } from "commons/environment/appconfig";
import { log } from 'commons/utils/logger';
Here I'm trying to import functions from my "commons" layer & trying to ...
0
votes
0
answers
67
views
Lambda Layers Nodejs and Typescript
I have the following class I am trying to make into a Lambda Layer in Nodejs.
import { Athena } from "aws-sdk";
export class AthenaHelper {
private athena = new Athena();
public ...
1
vote
2
answers
1k
views
how to add layer of awswrangular in the aws lambda layers, awsdatawrangular not there the list of layers?
writing program on aws lambda and got an error called "Unable to import module 'lambda_function': No module named 'awswrangler'", and after searching in yt, google not get any solution, how ...
2
votes
2
answers
2k
views
Unable to import module 'lambda_function': No module named 'Crypto'
I have following python lambda function
lambda_function.py
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad,unpad
import base64
#CBC with Fix IV
data = 'random text to be encrypted ...
1
vote
6
answers
3k
views
Importing the OpenAI Python dependency into AWS Lambda fails
I am trying to add the OpenAI Python library to my AWS Lambda function. I tried to add them via AWS Lambda Layers as described in this guide. However, when executing my code, the addition of this line:...
3
votes
2
answers
3k
views
Seemingly unrelated 'rpds.rpds' error when importing Python library onto AWS Lambda
I've been trying to move some python code I've written into AWS Lambda. It's a CSV validator that uses the 'pycsvschema' library, and works perfectly on my local PC. I had to do some finicking with ...
1
vote
1
answer
2k
views
Unable to import psycopg2 from AWS Lambda Layer due to problem with _psycopg module
I've been trying for several days to create an AWS Lambda function that uses psycopg2. After looking at numerous tutorials and lots of trial and error, I have the following process.
I build and run a ...
1
vote
1
answer
1k
views
How to install aws-wsgi and Flask in AWS Lambda?
I pip installed aws-wsgi and flask using AWS Cloud9 and then downloaded the zip file.
This file was then uploaded to a Lambda Layer, which was then attached to my Lambda Function. However, I still get ...
0
votes
1
answer
683
views
Unable to import pydantic in lambda function
I am trying to import pydantic to a lambda via a lambda layer
and I keep getting this error
[ERROR] Runtime.ImportModuleError: Unable to import module 'main': No module named 'pydantic' Traceback (...
2
votes
3
answers
6k
views
AWS lambda "Unable to import module 'lambda_function': No module named >'pydantic_core._pydantic_core'" using langchain and lambda layers
Context
I have a lambda with the following handler function:
import json
from langchain_community.llms import ollama
def lambda_handler(event, context):
return {
'statusCode': 200,
...
0
votes
0
answers
197
views
Lambda layers unable to import module failing with Runtime.ImportModuleError in serverless architecture
I want to implement Lambda Layers into my Serverless application. I plan to create three layers, each based on separate requirements.txt files located in separate directories. Unfortunately, I am ...