Questions tagged [aws-api-gateway]

Experience the power of Amazon API Gateway - an all-inclusive, hassle-free solution empowering developers to swiftly design, release, upkeep, track, and protect APIs effortlessly across any size requirement.

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 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 ...

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 ...

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 ...

CDK Error: Unable to locate MethodResponse in AWS API Gateway configuration

I'm facing an issue in vscode while trying to access the MethodResponse interface from apigateway. Unfortunately, I'm getting an error message: The type 'typeof import(".../node_modules/aws-cdk-lib/aws-apigateway/index")' does not have a prope ...

The CORS policy has blocked the AWS API Gateway request originating from 'http://localhost:8080'

Currently, I am facing an issue with deploying an API for use in Front End. The API functions properly when tested alone, but it returns a CORS error when integrated into a Vue app. The specific error message is as follows: Access to XMLHttpRequest at &a ...

Efficient Rotation with AWS Proxy in Conjunction with Amazon API Gateway and Selenium

Looking to scrape websites using selenium. Successfully implemented selenium on ec2, but since ec2 is tied to a specific IP, I'm interested in incorporating Amazon API Gateway rotating proxy into my python selenium script. Came across this helpful t ...

What is the best way to send an authorization bearer token to a Lambda function that is not an authorizer through API

I'm working with a node lambda function and looking to decode and access the payload of a jwt. My approach involved setting up a get method with lambda proxy integration enabled, passing only the authorization bearer-token to the endpoint. However, I ...

Updating DynamoDB objects seamlessly in Lambda functions without any conflicts

I am currently working with example Objects that follow this interface structure: interface Car{ id: Number; name: String; tires: Wheel[] } interface Wheel{ id: Number; name: String; radius: Number; } My goal is to store these Car Objects in DynamoDB and ...

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 ...

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 ...

The SAM application template.yaml is failing to generate APIs for the development environment

I am facing a challenge with my application which has different environments (dev, stage, prod) and I am utilizing AWS Codepipeline for the CI/CD process. Each environment requires different buildspec.yml and template.yaml files. The issue arises with AP ...

The AWS serverless-express deployed via AWS API Gateway is unexpectedly requesting authentication despite not being configured for it

Apologies for my novice question, but I am still getting the hang of AWS, NodeJS, and Express. I am in the process of setting up a simple serverless API Gateway: index.js import AwsServerlessExpress from 'aws-serverless-express'; import App fr ...

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 ...

Converting ExpressJS Function for Multipart Uploading to AWS Lambda

Looking for advice on converting this Express.js function to AWS Lambda for Node.js 18. const upload = multer() // Write received chunk to S3 bucket app.post('/upload', upload.single("file"), (req, res) => { const { index, fileName } = req. ...

Deliver a personalized error notification using serverless-http (express) framework

I am trying to send a custom error message in JSON format from my express app, which is served in a lambda function using serverless-http To achieve this, it seems I need to utilize LAMBDA_PROXY APIG integration to enable sending custom error messages dir ...

Issue with AWS API Gateway and Restful API: socket.io encounters an error stating that the route '/socket.io?EIO=4&t=xxx&transport=polling' does not exist

My backend API services are hosted on AWS using API Gateway and EC2 instance. The backend is built with Node.js/Express JS, and socket.io is used for real-time messaging. const initializeExpress = (): void => { const app = express(); let http = re ...

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": ...

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 ...

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 ...

The API Gateway consistently routes requests to the root path on my Express Server every time

I am working with an Api Gateway Rest Api that is protected by Cognito Authorizer and integrated via VPCLink to access my container hosting a NodeJs Express app. The complete flow looks like this: Api Gateway -> VPCLink -> NLB (Network Load Balance ...

Utilizing AWS Websockets with lambda triggers to bypass incoming messages and instead resend the most recent message received

I am facing an issue when invoking a lambda that sends data to clients through the websocket API. Instead of sending the actual message or payload, it only sends the last received message. For example: Lambda 1 triggers Lambda 2 with the payload "test1" ...

The SDK generated by AWS API Gateway does not include the JavaScript client file

After setting up my API with the AWS Api Gateway Service, I am now looking to integrate the javascript SDK into a basic webpage. The provided instructions for using the javascript SDK can be found here. However, they mention importing a js file named apig ...