Missing Authentication Token while accessing API Gateway?

I’ve lost some time for a silly reason: When you create a stage, the link displayed does not contain the resource part of the URL: API URL: https://1111.execute-api.us-east-1.amazonaws.com/dev API + RESOURCE URL https://1111.execute-api.us-east-1.amazonaws.com/dev/get-list The /get-list was missing And of course, you need to check that the method configuration looks like this:

Getting json body in aws Lambda via API gateway

There are two different Lambda integrations you can configure in API Gateway: Lambda non-proxy integration (docs), also called Lambda custom integration Lambda proxy integration (docs) For Lambda non-proxy integration, you can customise what you are going to pass to Lambda in the payload that you don’t need to parse the body, but when you are … Read more

XMLHttpRequest error in flutter web [Enabling CORS AWS API gateway]

this worked for me, I added the below header on the lambda function return { statusCode: 200, headers: { “Access-Control-Allow-Origin”: “*”, // Required for CORS support to work “Access-Control-Allow-Credentials”: true, // Required for cookies, authorization headers with HTTPS “Access-Control-Allow-Headers”: “Origin,Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,locale”, “Access-Control-Allow-Methods”: “POST, OPTIONS” }, body: JSON.stringify(item) };

AWS lambda api gateway error “Malformed Lambda proxy response”

Usually, when you see Malformed Lambda proxy response, it means your response from your Lambda function doesn’t match the format API Gateway is expecting, like this { “isBase64Encoded”: true|false, “statusCode”: httpStatusCode, “headers”: { “headerName”: “headerValue”, … }, “body”: “…” } If you are not using Lambda proxy integration, you can login to API Gateway console … Read more

Is there a way to change the http status codes returned by Amazon API Gateway?

Update per 20-9-2016 Amazon finally made this easy using the Lambda Proxy integration. This allows your Lambda function to return proper HTTP codes and headers: let response = { statusCode: ‘400’, body: JSON.stringify({ error: ‘you messed up!’ }), headers: { ‘Content-Type’: ‘application/json’, } }; context.succeed(response); Say goodbye request/response mapping in the API Gateway! Option 2 … Read more

API Gateway CORS: no ‘Access-Control-Allow-Origin’ header

I get the same problem. I have used 10hrs to findout. https://serverless.com/framework/docs/providers/aws/events/apigateway/ // handler.js ‘use strict’; module.exports.hello = function(event, context, callback) { const response = { statusCode: 200, headers: { “Access-Control-Allow-Origin” : “*”, // Required for CORS support to work “Access-Control-Allow-Credentials” : true // Required for cookies, authorization headers with HTTPS }, body: JSON.stringify({ “message”: … Read more

API Gateway – POST multipart/form-data

API Gateway does not currently support multipart form data. This is being considered for future development. In the meantime, you will need to modify your client to use multiple requests or a single one-part request. Update: API Gateway now supports binary payloads. Simply define multipart/form-data as a binary media type for your API and proxy … Read more

Can an AWS Lambda function call another

I found a way using the aws-sdk. var aws = require(‘aws-sdk’); var lambda = new aws.Lambda({ region: ‘us-west-2’ //change to your region }); lambda.invoke({ FunctionName: ‘name_of_your_lambda_function’, Payload: JSON.stringify(event, null, 2) // pass params }, function(error, data) { if (error) { context.done(‘error’, error); } if(data.Payload){ context.succeed(data.Payload) } }); You can find the doc here: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html

How to pass a querystring or route parameter to AWS Lambda from Amazon API Gateway

As of September 2017, you no longer have to configure mappings to access the request body. All you need to do is check, “Use Lambda Proxy integration”, under Integration Request, under the resource. You’ll then be able to access query parameters, path parameters and headers like so event[‘pathParameters’][‘param1’] event[“queryStringParameters”][‘queryparam1’] event[‘requestContext’][‘identity’][‘userAgent’] event[‘requestContext’][‘identity’][‘sourceIP’]