aws-api-gateway
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: “Hello … Read more
API gateway vs. reverse proxy
It is easier to think about them if you realize they aren’t mutually exclusive. Think of an API gateway as a specific type reverse proxy implementation. In regards to your questions, it is not uncommon to see both used in conjunction where the API gateway is treated as an application tier that sits behind a … Read more
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:
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’]