aws-api-gateway

Amazon API Gateway : response body is not transformed when the API is called via Postman?

浪子不回头ぞ 提交于 2019-11-30 18:10:41
问题 When executing a testvia the AWS API Gateway console, I see that the output response from the Lambda function is correctly transformed: { "type" : "", "message" : "", "request-id" : "" } See logs below: Tue Sep 06 14:46:06 UTC 2016 : Endpoint request body after transformations: {} Tue Sep 06 14:46:06 UTC 2016 : Endpoint response body before transformations: {"errorMessage":"501stef"} Tue Sep 06 14:46:06 UTC 2016 : Endpoint response headers: {x-amzn-Remapped-Content-Length=0, x-amzn-RequestId

Enable CORS when using AWS API Gateway Request Validator

人盡茶涼 提交于 2019-11-30 17:14:52
问题 I setup AWS API Gateway with CORS successfully, when a request is valid I have a 200 status code and also CORS headers, that's nice. But when AWS API Gateway Request Validator detects an invalid input, I have the status code is 400 but CORS headers are not sent... That's really unfortunate, because the client sees a CORS errors instead of a real 400 error (for exemple with fetch the client is not able to distinguish 400 errors because of CORS errors). This question may be related to Get

AWS Api Gateway as a HTTP Proxy is currupting binary uploaded image files

爷,独闯天下 提交于 2019-11-30 16:55:54
I have a ruby on rails app that takes an image file, "attaches it to a member", and uploads it to s3. When I use insomnia and POST directly to the app ... it works , however when I use the exact same endpoint behind AWS Api Gateway, the image is corrupt and not viewable. Here is the comparison of the requests. LEFT = directly posted to the rails app RIGHT = through api gateway https://www.diffchecker.com/wwUmpB5W Something I noticed, is that the paperclip gem is running different commands. It's evident that paperclip realized that the file is not an image when being passed through API gateway.

AWS API Gateway Signature

时间秒杀一切 提交于 2019-11-30 16:18:24
问题 I am trying to sign my requests to the amazon gateway. But every time when I try to send a POST request it tells me that my signature has been expired. Any ideas will be appreciated. 回答1: You have some problem with getting the time or something like that. I had the problem with the payload. So if you are making GET request your payload is an EMPTY STRING . Otherwise it should be hashed Json object. Here is example of how I do it in my application. The code can be raw, but I am 100000% it work

AWS Api Gateway as a HTTP Proxy is currupting binary uploaded image files

末鹿安然 提交于 2019-11-30 16:12:31
问题 I have a ruby on rails app that takes an image file, "attaches it to a member", and uploads it to s3. When I use insomnia and POST directly to the app ... it works , however when I use the exact same endpoint behind AWS Api Gateway, the image is corrupt and not viewable. Here is the comparison of the requests. LEFT = directly posted to the rails app RIGHT = through api gateway https://www.diffchecker.com/wwUmpB5W Something I noticed, is that the paperclip gem is running different commands. It

Passing ARN reference from CloudFormation to Swagger

99封情书 提交于 2019-11-30 15:56:16
We are trying to automate the deployment of AWS lambda and API gateway using Amazon CloudFormation and Swagger. Towards this, we have created a CloudFormation template to create the Lambda and other resources required for APIGateway (including the endpoints). We would like to import the API definitions from an external swagger file so that the same CloudFormation template can be used for multiple lambdas and APIGateways. Is there a way we can refer the ARN of the lambda which has been created by the CloudFormation template in the external swagger file (being referred to in the same

Validating request path parameter of AWS API gateway?

限于喜欢 提交于 2019-11-30 15:47:30
问题 Let's say I have an api with paths / and /{pets} and /{pets}/pet . Now I'm trying to validate the path {pets} parameter so that only path having alphanumerical characters of length 6 will be validated and processed to the backend lambda all others will be rejected. I tried the following swagger schema specifying format and type for the parameter. I even tried using pattern in the schema but it seems to be not working. May I know how can we limit only path parameters of certain IDs. { ...... "

AWS API Gateway with Angular

与世无争的帅哥 提交于 2019-11-30 15:34:11
问题 Has anyone gotten the AWS API Gateway to work with an Angular.js front-end? I have a lambda function that's exposed via a POST method in the API Gateway. I set up the headers as indicated by this doc: http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html I tested it in Postman and it works great. I didn't have to do anything special, but when I do the $http.post() call I only get No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin http:/

Client certificates with AWS API Gateway

时光毁灭记忆、已成空白 提交于 2019-11-30 13:56:56
I am trying to implement mutual authentication for the communication between aws api gateway and my server. I want to use the client side certificates that amazon offers for authentication. I know that my server is configured correctly because previously I was using a lambda function and mutual authentication was working. I have exported the (.PEM) certificate and added it into a truststore. I have configured my Jetty server to use that truststore for authentication. I have set client-auth to :need. I know my server is set up correctly because it was working with with my self-implemented

How to pass array query params to AWS API Gateway?

[亡魂溺海] 提交于 2019-11-30 12:49:36
A Rails API typically likes array query params like this: example.com?colors[]=cyan&colors[]=magenta&colors[]=yellow&colors[]=black How would I map that through to a lambda function? A little trial and error shows that it's like this: example.com?colors=['cyan','magenta','yellow','black'] One thing you can't do is have duplicated query string param keys as per https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html : Duplicated headers are not supported. API Gateway maps the parameters to a JSON object so as long as each item has their own unique key, you won