aws-api-gateway

Access headers in AWS API Gateway using HTTP Proxy?

99封情书 提交于 2019-12-03 15:45:00
I'm using AWS API Gateway and it's HTTP Proxy, I need to pass Authorization header to my endpoint through AWS API Gateway Things I've tried: Setting Method Request like so, Integration Request setup This doesn't work, my app doesn't receive the Authorization header, Also I've tried using mapping template { "method": "$context.httpMethod", "body" : $input.json('$'), "headers": { #foreach($param in $input.params().header.keySet()) "$param": "$util.escapeJavaScript($input.params().header.get($param))" #if($foreach.hasNext),#end #end }, "queryParams": { #foreach($param in $input.params()

AWS API Gateway Binary output without Accept header

和自甴很熟 提交于 2019-12-03 15:41:49
According to http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings.html If contentHandling is not defined, and if the Content-Type header of the response and the Accept header of the original request match an entry of the binaryMediaTypes list, API Gateway passes through the body. This occurs when the Content-Type header and the Accept header are the same; otherwise, API Gateway converts the response body to the type specified in the Accept header. I can't make the original request to send the Accept header. How can I make my AWS API Gateway to return in

Get non file body from multipart/form-data using AWS API Gateway and Lambda

纵饮孤独 提交于 2019-12-03 15:18:19
I am trying to get the form data from a multipart/form-data POST to my ASW Lambda web service via API Gateway. The HTTP POST has Content-Type "multipart/form-data" and body that is URL encoded. File data is also sent in this post (hence the multipart, I guess). The web service needs to integrate with a thirdparty service, so changing the format of the POST isn't really an option. I have seen this thread talking about converting the URL encoded data to JSON object for use in Lambda, but this doesn't do the trick. I have also tried setting the Integration Request -> Mapping Templates for content

AWS API Gateway - using Access Token with Cognito User Pool authorizer?

删除回忆录丶 提交于 2019-12-03 14:41:14
I am configuring an app with various frontends (mobile and web apps) and a single API backend, powered by Lambda and accessed via AWS API Gateway. As I'm planning to use Cognito to authenticate and authorize users, I have set up a Cognito User Pool authorizer on my API Gateway and several API methods. With an architecture like this, it seems logical that my apps (e.g. an iOS or Vue.js app) are the Client applications from an OAuth perspective, and my API Gateway backend is a Resource Server. Based on this Auth0 forum post it seems clear that I should therefore use an ID token in my client app,

How to invoke an AWS Step Function using API Gateway

强颜欢笑 提交于 2019-12-03 14:06:44
问题 How do I invoke an AWS Step Function using an API Gateway POST request, and the request's JSON payload to the Step Function ? 回答1: 1. Create your step function Quite obvious. I guess that if you're reading this you know how to do it. Otherwise, you can go have a look at the documentation here: What is AWS Step Functions?. 2. Create the IAM Role for your API It can be for either all Step Functions, or only this one. We'll only cover the first case, as explained in an Amazon tutorial: Creating

Posting from AWS-API Gateway to Lambda

南笙酒味 提交于 2019-12-03 13:29:31
问题 I have a simple C# Aws Lambda function which succeeds to a test from the Lambda console test but fails with a 502 (Bad Gateway) if called from the API Gateway (which i generated from the Lambda trigger option) and also if I use postman.(this initial function has open access (no security)) // request header Content-Type: application/json // request body { "userid":22, "files":["File1","File2","File3","File4"] } The error I get in the logs is: Wed Feb 08 14:14:54 UTC 2017 : Endpoint response

How to call AWS API Gateway Endpoint with Cognito Id (+configuration)?

元气小坏坏 提交于 2019-12-03 12:41:19
I want to call an AWS API Gateway Endpoint that is protected with AWS_IAM using the generated JavaScript API SDK . I have a Cognito UserPool and a Cognito Identity Pool . Both properly synced via ClientId . I use this code to Sign in and get the Cognito Identity AWS.config.region = 'us-east-1'; // Region AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'us-east-1:XXXXXXXXXXXXXXXXXXXXXXXX' // your identity pool id here }); AWSCognito.config.region = 'us-east-1'; AWSCognito.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'us-east-1

how to make AWS api gateway accept http instead of https

梦想的初衷 提交于 2019-12-03 12:17:17
I have a Lambda function proxied by API Gateway. However, API Gateway only expose http s and not http. I searched everywhere but looks like API Gateway is not possible to accept http. So my question is how to translate http client calls to https and send to api gateway? I am asking because my client can only make http calls and they won't change. I recently had a 4 hour long phone call with an AWS representative about a similar problem we had in production stage. My situation was similar, there was nothing we could change in APIGateway to fix it (the rep tried all kinds of tricks, but nothing

Access HTTP request (headers, query string, cookies, body) object in lambda with http endpoint

故事扮演 提交于 2019-12-03 11:11:35
I am trying to see how to access the request header and body values from with in the lambda code. If the request body is in JSON format, it automatically seems to be parsed and made available in the event object. How can I access the complete query string, request body, request headers (cookies) for any type of incoming "Content-Type" request inside Lambda ? The edits below are information I have gathered to help solve the question that may or may not be relevant. Please ignore them if you wish to. EDIT: I went through the existing questions on SE here and here . As per this thread , using

Fail to enable CORS for API Gateway functions

旧街凉风 提交于 2019-12-03 10:56:18
I get While attempting to enable CORS on API Gateway, why is that and how do I resolve this? These functions are deployed using AWS SAM. But I notice if I create my own APIs via AWS Console this happens too The errors looks like: invalid model name specified application/json=Empty invalid response status code specified I found I seem to need to add an "Empty" response model myself? Now, I get Add Access-Control-Allow-Origin Integration Response Header Mapping to POST method (invalid response status code specified) How do I resolve this? Firstly please select your root resource and select