Questions tagged [aws-lambda]

AWS Lambda is a highly efficient platform that empowers you to execute code seamlessly, freeing you from the hassle of server management. (Please note that this should not be confused with the [lambda] tag, which specifically denotes a distinct type of function.)

Tips for converting the output stream produced by wkhmtlopdf in a Node.js environment to a base64 string without first converting it to a buffer by utilizing AWS Lambda

I have a unique project requirement where I am tasked with converting HTML to PDF using wkhtmltopdf in combination with node.js and AWS Lambda. To accomplish this, we are utilizing the nodejs wrapper for wkhtmltopdf (nodejs-wkhtmltopdf). Up until now, our ...

After deploying my Node.js/Express.js application to AWS Lambda, I encountered a bcrypt error

I'm currently facing an issue with getting my express.js app to run on AWS Lambda. Despite successfully deploying it using the serverless framework, I encounter a 500 internal error when testing requests. The log displays the following error message: ...

There is no 'Access-Control-Allow-Origin' header found on the requested resource while utilizing AWS API Gateway in conjunction with AWS Lambda

Working on my backend, I have integrated AWS API gateway with AWS Lambda. I made sure to enable cors for my endpoint. However, upon testing the endpoint on the browser, I encountered the following error: No 'Access-Control-Allow-Origin' header is present ...

Errors occur when attempting to parse Uint8Array in Typescript

I received the following object as a response from calling the AWS Lambda client in NodeJS. { '$metadata': { httpStatusCode: 200, requestId: '1245', extendedRequestId: undefined, cfId: undefined, attempts: 1, totalRetryDelay: 0 }, ...

AWS Lambda serverless deployment of Angular Universal is failing to detect javascript files in the dist/browser directory

After following the steps in this tutorial for deploying to a lambda function, I encountered some issues. When testing it using serverless offline, I kept getting 404 errors for each compiled JS file. However, once I deployed it, the errors changed to 403. ...

Most efficient method: Exporting a DynamoDB table to a CSV file and saving it in an S3 bucket

Is there a more efficient way to export a DynamoDB table into an S3 bucket in CSV format? We already have a lambda function set up to update the DynamoDB table, but now we need to export the entire table. I came across a method of streaming directly from ...

LambdaFunctionAssociationError: The size of the function code exceeds the maximum allowed limit

Encountering an error while trying to add a Lambda function association to a CloudFront distribution com.amazonaws.services.cloudfront.model.InvalidLambdaFunctionAssociationException: The function code size exceeds the maximum allowed size for functions ...

What is the recommended method for deleting sequelize.connectionManager.getConnection according to the Sequelize documentation?

I am currently developing an AWS Lambda function using Typescript that interacts with a database through Sequelize. According to the official Sequelize documentation, the configuration for Sequelize should be as follows: let sequelize = null; async func ...

Serverless Framework Express Rest-API encounters a 502 Bad Gateway Error

Currently, I am working on building an express rest-api using the serverless framework with the code provided below. The issue I am facing is that while the POST request method to the path /fruits is functioning properly, the GET request method is resultin ...

Experiencing unexpected 502 Bad Gateway errors from AWS API Gateway following an update to Lambda runtime from Node 8.x to Node 12.x

After transitioning our staging environment for the REST API from NodeJS 8.x to NodeJS 12.x on AWS Lambda due to end of life for NodeJS 8.x runtime, we have encountered a new issue. Periodically, requests from our frontend web app to API Gateway fail with ...

Using NestJs for serverless functions with MongoDB is causing an excessive number of connections to be

In our project, we are utilizing nestjs for lambda functions that communicate with mongodb for data storage. Our implementation involves using the nestjs mongoose module. However, upon deployment, a new set of connections is established for each invocation ...

Unleashing the Potential: A Guide on Reinstating the Dialog.Delegate Directive into

I need assistance in creating a straightforward multi-turn dialog using the Alexa Skill model. My intent comprises of three slots, all of which must be filled to fulfill the intent. I have provided prompts for each slot and defined all necessary utterances ...

Bring in Lambda layers on your local device

I've been trying to create a lambda function with a layer, but I'm stuck on how to get it running locally. Here's the current directory structure: - projectDir/ | - lambdas/ | | - match-puller/ | | | - scr/... | | | - index.ts | | | - package.jso ...

Sentry's Trail Track feature in AWS Lambda

Upon freezing and restarting the AWS Lambda function (hot start), we have noticed that the previous breadcrumb messages persist, appearing on the Sentry dashboard as old messages. It appears that the breadcrumbs are not cleared after the captureException ...

AWS Cognito User Pools Event Trigger Object

Looking to create a unique verification message for new users registered in my AWS Cognito User Pool. I'm attempting to link a Lambda function with a "Custom message" trigger to achieve this. The challenge lies in identifying the exact format of the cust ...

Error message: "An internal server issue occurred while attempting to upload an image in base64 format via AWS Lambda

I've been working on uploading images to S3 using AWS Lambda. I found some helpful code in a URL and made some modifications to the variables fileFullPath and Bucket: Upload Image into S3 bucket using Api Gateway, Lambda funnction const AWS = requir ...

What is the best way to access form data in an AWS Lambda function coded in NodeJs?

In the process of constructing an application, I am utilizing ReactJS for the front-end and AWS API Gateway/AWS Lambda in NodeJS for the back-end. The form data from my React app is being passed within the userAttributes attribute as illustrated below: ht ...

Running Next.js in AWS Lambda with the `experimental-edge` runtime can be achieved by following these steps

I am currently exploring the possibility of running Next.js (v13.0.6) with OG image generation logic using @vercel/og in AWS Lambda. Everything runs smoothly locally, both in development and production modes. However, I encounter a 500 error when attempti ...

Using aws-sdk to download an object from S3 and handling redirects

To summarize, my goal is to resize an image using a combination of redirection, AWS Lambda, and the aws-sdk. After following a tutorial on resizing images dynamically with AWS titled AWS - resize-images-on-the-fly, I was able to successfully implement eve ...

Transferring data from URL straight to S3 in Lambda with an excessive memory consumption

Utilizing AWS Lambda with node.js, I successfully streamed files directly from a URI to S3 without the need for downloading them onto disk by adapting code from this individual's sample. After making some adjustments to create a buffer from a request ...

Tips for sharing parameters between Lambda Functions in AWS Step Functions

After scouring the internet, I couldn't find a solution that works for me in Python. I'm trying to pass certain parameters from one lambda function to another within a step function, but it's proving to be more challenging than expected. Can someone provid ...

Storing the information received from an API as an HTML element

My HTML file contains JavaScript, along with a URL that displays data retrieved from an AWS lambda API call via AWS API Gateway. The page initially appears blank and the data is structured like this: [ {"user": "bob", "groups": ["bobsGroup"], "policies": ...

Creating NodeJS Lambda - identical content, distinct SHA checksum

I'm encountering a perplexing issue and I can't seem to identify the root cause. Let me share my experience: My objective is to utilize Terraform for managing Lambda functions, with CircleCI serving as the orchestrator. The process unfolds as follows: ...

Python Package limit exceeded when uploading Lambda Function

My python code has several dependencies that need to be included: import json import pydicom from pydicom.dataset import Dataset, FileDataset from pydicom.uid import ImplicitVRLittleEndian import numpy as np from PIL import Image import cv2 import datetime ...

Strategies for rapidly increasing user numbers in Amazon Cognito

Our team recently encountered an issue with hitting the request limit on Cognito due to trying to retrieve too many users at once. These users are grouped in game pools. Currently, our only method of obtaining users is through adminGetUser in parallel. Is ...

Problem with cropping video using ffmpeg in a Node.js Lambda function

I wrote a lambda function specifically for cropping videos using ffmpeg Here is how I am setting up the layer: #!/bin/bash mkdir -p layer cd layer rm -rf * curl -O https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz tar -xf ffmpeg-git-a ...

Exploring the process of looping through S3 bucket items and delivering notifications to SQS

I've successfully developed a function that retrieves messages from an SQS Dead Letter Queue (DLQ) and uploads them to an S3 bucket. Now, my goal is to create another function or method to resend these messages from the S3 bucket. Currently, I'm attempti ...

Playing around with TypeScript + lambda expressions + lambda tiers (AWS)

Having trouble importing modules for jest tests in a setup involving lambdas, lambda layers, and tests. Here is the file structure: backend/ ├─ jest.config.js ├─ package.json ├─ babel.config.js ├─ layers/ │ ├─ tsconfig.json │ ├ ...

Utilize a solution to handle limited storage space in lambda functions for temporary data,

Looking to create a Lambda function that can fetch an s3 object, save it to the /tmp directory within the function, and then use crypto.createHash(algorithm) on the object. However, I'm facing a challenge with objects larger than 500MB due to Lambda's st ...

Upon completing the construction and deployment of a Lambda function using AWS SAM CLI, I noticed a message in the logs stating "Client network

Update: Initially, I used the correct callback(null, response) but then encountered the need to run sam init again for a different project and install a new node version with nvm. The lambda function below is responsible for creating a new item in datocms ...

Setting up node version 6.10.3 as a required NPM package

Currently working on projects utilizing the serverless framework to eventually be deployed to AWS Lambda, my end goal is to have them run seamlessly with the same version of node that is supported on AWS Lambda - which happens to be node 6.10.3. Despite ad ...

Exclude JSON Property if it Lacks a Certain Value

I'm attempting to retrieve specific values from a DynamoDB database where the name is "john". The challenge I'm facing is that although I can fetch values containing name: john from a mapped list, I also receive additional unwanted values. When running th ...

Can a File Object be transmitted to an AWS Lambda function via API Gateway using JavaScript?

Can a JavaScript File Object be passed from a browser to AWS Lambda via API Gateway (ultimately to S3)? I am working with TypeScript and React. Environment Frontend TypeScript React AWS Amplify (for API module) Backend(AWS Lambda) Node.js Expecta ...

Experiencing problems with the response from the Netlify Lambda function.. consistently receiving undefined results

I've been working on setting up a lambda function to handle authentication, validation, and sending of a contact form. As I'm new to lambda functions, my code might have some flaws. However, despite my efforts, I am struggling to modify the response sent ...

How can I showcase a Python variable in HTML within a lambda function?

Is it possible to include the "Message2" variable in the HTML "BODY_HTML" section of the lambda function below? import boto3 from botocore.exceptions import ClientError def lambda_handler(event, context): Message1 = event ["Message"] print("M ...

When using lambda functions with async.parallel, the last callback function may not be executed

I have created a lambda function in node.js with two files - index.js and loader.js. The problem I am facing is that the callback function in index.js is not being executed after the method in loader.js completes its execution. Below is the code: var yat ...

Error encountered during the execution of a Lambda function in NextJS API using AWS Ampl

I am currently facing an issue with my NextJS app running on AWS Amplify. I have created a basic REST API by adding a pages/api directory to my project. The endpoint successfully returns test JSON data when the project is run locally. However, after deploy ...

Using TypeScript with AWS Lambda: To package imports or not to package? Alternatively: Error in Runtime.ImportModule: Module '@aws-sdk/...' not found

I have been working with the code in my lambda.ts file, attempting to execute it on an AWS Lambda: import 'aws-sdk' import { /* bunch of stuff... */ } from "@aws-sdk/client-cloudwatch-logs"; import {Context, APIGatewayProxyResult} from 'aws-lambd ...

Difficulties Encountered when Converting HTML to PDF with Puppeteer on AWS Lambda

HTML TO PDF Struggling with the conversion of HTML to PDF using Puppeteer in a Node.js 16 AWS Lambda environment is proving to be quite challenging. Puppeteer's performance seems to vary when deployed on AWS Lambda or serverless setups, despite work ...

HTTP / HTTPS GET Request Alexa Skill - "The result is not valid" Lambda Reply

Currently, I am in the process of developing an Alexa skill that assists users in finding the nearest Kaiser Permanente hospital, clinic, or pharmacy. During testing, if one of the three specific keywords is used, I encounter an error message: The response ...

AWS Lambda, where the billing time exceeds the actual processing time

While working on my Lambda function in Node.js, I noticed a significant difference in the time measured from the start to the end of the function compared to the billed duration provided by Lambda. The function itself takes around 1400 milliseconds to exec ...

Current solutions are ineffective - (AWS Lambda API) The 'Access-Control-Allow-Credentials' header value in the response is empty, but it should be set to 'true'

My Lambda Function module.exports.handler = async(event, context, callback) => { return { statusCode: 200, headers: { "Access-Control-Allow-Credentials" : 'true', 'Access-Control-Allow-Origin': 'mydomai ...

Encountering import error while trying to use SOAP Node JS package on AWS Lambda deployment

My Lambda function on Node JS 10.x is encountering an issue when attempting to require the soap npm module, resulting in the following error message. { "errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module 'soap&ap ...

Error: Lambda function response malformed, please check API Gateway configuration

According to the official documentation, my JSON response should include a body, headers, and a status code, which it does. However, when testing in API Gateway, I am encountering issues with receiving a malformed response. Below is the output of my metho ...

Running Vercel's AI SDK on AWS Lambda and API Gateway: Step-by-step guide

I am currently working on deploying my NextJS Vercel AI SDK App on AWS using Cloudfront, Lambda, and API Gateway. One of the challenges I'm facing is modifying the useChat() function to incorporate the API from my Lambda Function, which handles the connec ...

I am in need of capturing a screenshot of a specific URL using chromedriver and

Is there a way to capture a screenshot of a website based on specified screen size, pixels, or by performing scroll up and down operations? I need to do this similar to using the snipping tool. Can anyone provide me with a solution to achieve this using th ...

Error: Invalid connection string for ELF Lambda detected

Having an issue with a lambda function that connects to a remote MongoDB on an EC2 instance using TypeScript. While I can connect to the database locally, there is an ELF error when running in lambda. It seems to be related to mismatched binaries of npm pa ...

Nextjs encountered a TypeError stating "Unable to access the 'headers' property of undefined" following an upgrade to nextjs version 12.1.0

After upgrading to Next.js 12.1.0, I encountered an error when calling the api route using aws amplify. The CloudFront console reported the following error: This is my api route: const handlerProducts = async (req: NextApiRequest, res:NextApiResponse) =& ...

Steps for extracting URL parameters from AWS API Gateway and passing them to a lambda function

After successfully setting up my API gateway and connecting it to my lambda function, I specified the URL as {id} with the intention of passing this parameter into the lambda. Despite numerous attempts using both the default template and a custom one for ...

Issue with Npm mysql and AWS Lambda: Query cannot be enqueued after invoking quit command

Currently, I am in the process of creating various AWS Lambda functions for testing purposes. To connect to the RDS database, I'm utilizing the npm mysql package. The code provided below functions properly. However, after every alternate function exec ...

Error message: Issue with AWS Serverless Lambda and Angular - TypeError: express function not defined

I'm encountering an issue when trying to deploy my application from localhost:4200 to AWS serverless Lambda. The error in cloudwatch logs is causing a 500 {"message": "Internal server error"} response when I access the URL. My understanding of AWS is limi ...

Encountering difficulty while importing Cognito: "The variable 'AmazonCognitoIdentity' is not recognized."

As a beginner in Node JS, I have been learning from online examples and AWS documentation through their web-based lambda editor. However, when using the following code snippet, I encountered an error stating "AmazonCognitoIdentity is not defined". I would ...

Transferring a file from the /tmp directory on Amazon Lambda to an S3 bucket using Node.js

My current project involves developing a straightforward screenshot program using Amazon Lambda. The program will take a snapshot of a specified URL and store it in JSON format like this: { "site": "www.example.com", "width": "320", "height": "480" ...

Utilizing AWS Amplify with TypeScript and TypeScript Lambdas for powerful web development

Currently, I am working on a project that involves a nextjs frontend with TypeScript and AWS Amplify for the backend. My intention is to write my Lambda functions in TypeScript as well. However, I have encountered an issue where I have one tsconfig.json fi ...

In what way can a Express Node app be successfully deployed with npm modules on AWS Lambda?

I am looking to host my node application on AWS Lambda, but I am facing an issue with npm packages that are not pre-installed in lambda. How can I successfully deploy my entire node app on lambda? One option is to upload the files as a zip file, but how ...

Experiencing difficulties when attempting to deploy script to AWS Lambda

My current challenge involves executing a script that utilizes Selenium and specifically webdriver. driver = webdriver.Firefox(executable_path='numpy-test/geckodriver', options=options, service_log_path ='/dev/null') The problem I am ...

What is the best way to specify the parameter for updating the value of a specific property within an object that is stored in an array?

Looking to update the quantity value based on the title in the movies array and Item id (123). I've successfully updated the value at the first layer (name: David), but now I need help updating the second layer with an additional filter for the array ...

Transfer the AWS configuration settings to the imported module

Currently, I am attempting to perform unit testing on a JS AWS Lambda by running it locally. To simulate the Lambda environment, I am taking on the same role that the Lambda would have with AWS.config.credentials and then executing the Lambda function that ...

I plan to securely store the verification code from Cognito into our database for future use and send the email at a later time

exports.handler = async event => { console.log(event); try { const { userName } = event; const { codeParameter } = event.request; let userParams = { userId: userName, codeParameter }; // Determine the reason for this function being i ...

[AWS Lambda SDK] - Executing Lambda Function - Processing Payload Response as Unit8Array - Conversion to String

Currently, I am utilizing the npm package @aws-sdk/client-lambda to invoke Lambdas. In my setup, I have two Lambdas - Lambda A and Lambda B, with Lambda A responsible for invoking Lambda B. The invocation of Lambda B from Lambda A is done through the foll ...

AWS lambda not properly displaying static content for an Angular application when running Node Express server

Recently, I encountered an issue while trying to deploy my Angular application on AWS Lambda. I kept receiving a 403 exception for my static content, even though I used Express.js to configure the server. You can check out the problems I'm facing at this [ ...

Executing MySQL inserts using AWS Lambda and Node.js

During my usage of Amazon Lambda to run a nodejs function, I encountered an issue with inserting data into a mysql DB after performing an HTTP get request. The Cloudwatch logs appear fine, indicating that the query is parsed correctly, and when I manually ...

Using NodeJS API gateway to transfer image files to S3 storage

I have been attempting to upload an image file to S3 through API Gateway. The process involves a POST method where the body accepts the image file using form-data. I crafted the lambda function in TypeScript utilizing the lambda-multipart-parser. While it ...

Obtain information from a website, then initiate a lambda function to send an email and store the data in

As a beginner, I came across two different sets of instructions online. The first one was about using AWS Lambda to send data (Contact us - Email, Phone, etc) to my email via Amazon API Gateway and Amazon SES: https://aws.amazon.com/blogs/architecture/cre ...

"Setting up the latest version of Selenium along with ChromeDriver and Headless Chrome driver for automated testing

Utilizing Python and Selenium with AWS Lambdas for web crawling has been a part of my workflow. After upgrading Python to version 3.11 and Selenium to version 4.18.0, I encountered issues that caused my crawlers to cease functioning properly. Below is the ...

Building a Python Lambda function that connects to an AWS HTTP API

In this resource, you can find a guide on how to create an HTTP API that triggers a Lambda function using a node.js runtime. I recently attempted the same process with a Python lambda using the following handler: def lambda_handler(event, context): r ...

Exploring data in Dynamodb database

Utilizing Lambda, API-gateway, and DynamoDB with Python 3.6 for managing orders. I have a DynamoDB table structured as follows: orderId (primary Key|String) orderStatus (String) orderCode (String) date (String) The orderId field is unique. However, when ...

Encountering a 'Page Not Found' Message when accessing a Node.js Lambda Microservice Serverless Express.js with Compression

I'm currently grappling with understanding how the compression nodejs library operates and why it's causing issues in my specific scenario. The code I've developed is intended to be executed on AWS Lambda running nodejs 6.10. Below is my index.js file whi ...

Error in AWS Lambda: JSON parsing error due to unexpected token 't' at position 6

I'm currently working on a basic lambda function that utilizes a post request to insert data into DynamoDB. However, every time I deploy the lambda function and test it using Postman, I keep encountering a 502 Bad Gateway error. To troubleshoot this ...

Excessive memory usage is a common issue when making HTTPS requests with Node

I'm attempting to load the JSON from this URL . The file is quite large at over 600MB in size. Within a lambda function, I have configured it with a timeout of 10 minutes and allocated 3008MB of memory. However, the function seems to be utilizing more tha ...

Is it feasible to take user input in Python with AWS Lambda?

I am currently developing an AWS Lambda function with the purpose of assisting users in collecting data from a website by using selenium and headless-chromium. The website has a SMS code verification process during login, which requires the user to input t ...

Deployment failure of AWS CDK caused by Error: Lambda Function Invalid

I'm in the process of integrating a Lambda authorizer into my REST API using AWS CDK. const api = new apigw.RestApi(this, 'apiname', { defaultCorsPreflightOptions: { allowOrigins: apigw.Cors.ALL_ORIGINS } }); const authorizerFuncti ...

The AWS Lambda function in Node.js encountered an internal server error

I've been experimenting with AWS Lambda functions, Axios, and Cheerio in a demo project. However, when I call the endpoint, I receive an error message saying {message: Internal Server Error} exports.lambdaHandler = async (event, context) => { try ...

Having trouble transmitting POST data to Lambda

I've encountered an issue where my lambda function isn't receiving the data I'm trying to send. The event variable appears to be empty, and despite testing the function in my API Gateway without any errors, the data doesn't seem to be reaching the lambda f ...

Utilize a specialized Python module within various modules independently

I have developed a custom Python module called awesome-lib.py, which needs to be imported and utilized by multiple other Python modules (module1.py, module2.py, etc). The challenge lies in the fact that all of these modules must reside in separate folders, ...