aws-api-gateway

How do I convert XML to JSON AWS API Gateway?

别说谁变了你拦得住时间么 提交于 2020-01-04 05:24:06
问题 I am trying to use Amazon's AWS API gateway to front legacy SOAP services with REST. I am able to take a resource request and basically hard code SOAP request in a Body Mapping Template. The SOAP service is called and the XML SOAP response is returned. So far so good. In the Integration Response, I need to take this SOAP envelope (Basically just XML) and map that back to the JSON model. I don't see how this can be done, but I must be missing something. The following code will get the raw

How do I convert XML to JSON AWS API Gateway?

这一生的挚爱 提交于 2020-01-04 05:24:02
问题 I am trying to use Amazon's AWS API gateway to front legacy SOAP services with REST. I am able to take a resource request and basically hard code SOAP request in a Body Mapping Template. The SOAP service is called and the XML SOAP response is returned. So far so good. In the Integration Response, I need to take this SOAP envelope (Basically just XML) and map that back to the JSON model. I don't see how this can be done, but I must be missing something. The following code will get the raw

API Gateway returning 403 - Forbidden

别说谁变了你拦得住时间么 提交于 2020-01-04 04:36:20
问题 I have an API Gateway with an endpoint that is fulfilled by AWS Lambda proxy integration. I have also configured a custom authorizer for this endpoint. I am seeing an issue where the first request that I make to this endpoint is successful, but additional calls will fail; I get a 403 - Forbidden error. If I wait a while, I can make another request that succeeds but then I start seeing the same problem. Here's my code for the authorizer: const jwt = require('jsonwebtoken'); exports.authorizer

AWS API Gateway default response and Trigger AWS Lambda

百般思念 提交于 2020-01-02 10:18:12
问题 I have been experimenting with AWS API Gateway and AWS Lambda to try out a serverless architecture. Have been going through blogs and AWS documentation. Have tried out sample GET/POST. But, I have the following requirement w.r.t tracking user events from my custom application Events are posted from my application to API end point I wanted the API to respond back with a custom response (Say {'fine'}) (acknowledging that the request has been received) After the response is sent, hand over the

Can AWS API Gateway cache invalidate specific entries based on the response content?

喜你入骨 提交于 2020-01-02 10:01:49
问题 I have used AWS API Gateway with the endpoint as a lambda function. I have enabled the cache functionality provided by API Gateway, to reduce both response time & the number of calls forwarded to my lambda function. The lambda function queries another data store to return data. If data is not found, an asynchronous call is made to update the data store and "data not found" is returned to the caller. Now the API Gateway is even caching this result, which we do not want to happen. This results

Can't use custom Request Headers on AWS API Gateway with CORS

匆匆过客 提交于 2020-01-02 09:43:34
问题 I have created and deployed an AWS API Gateway resource with the following structure including a custom HTTP Request Header 'X-header' dev (stage) /echo (resource) POST (method) Method Request - Headers: X-header OPTIONS (method) Method Request - Headers: X-header When I POST to the endpoint from Chrome, I get the following error. XMLHttpRequest cannot load https://fxxxx.execute-api.us-west-2.amazonaws.com/dev/echo. Request header field X-header is not allowed by Access-Control-Allow-Headers

AWS API Gateway: Regex for error is not picked up

情到浓时终转凉″ 提交于 2020-01-02 05:41:08
问题 I have a Lambda function tied to the AWS API gateway. When I call it with something like /foo/bar and bar does not exist, my function returns (correctly) something like: { "code": 404, "message": "bar not found" } I now want the status code of this to be 404, too, but following the tutorials I could find on the net, I had no success so far. What I did: I created a method response for 404 that looks like this: And in the integration response, I set the following: To my understanding, this

AWS API Gateway CORS ok for OPTIONS, fail for POST

你说的曾经没有我的故事 提交于 2020-01-02 02:22:52
问题 I've looked at the other related questions on SO but this seems different. In fact, my question is very similar to this one, except I don't have the 400 status issue. The set up: lambda function through API Gateway Authorization: None, API KEY Required: false deploying to stage: test 1 resource, 1 POST method integrating the lambda. Calling the POST endpoint directly e.g. with curl always returns 200 (with/without payload, bad payload, etc.) - so that's different from the referenced question.

Access AWS API Gateway with IAM roles from Python

雨燕双飞 提交于 2020-01-02 02:11:29
问题 I have an AWS API Gateway that I would like to secure using IAM Roles . I am looking for a package to help me accessing it using Python. I am trying to avoid implementing the entire Version 4 Signing Process. I am sure there must be some library I can use. I looked into aws-requests-auth but it requires a "aws_service" to generate the signature. I looked also to boto3 but I am not able to find any way to just add authentication headers to a general request. 回答1: You can use aws-requests-auth

AWS API Gateway - CORS “access-control-allow-origin” - multiple entries

岁酱吖の 提交于 2020-01-02 02:05:08
问题 I have a AWS Lambda instance that connects to a defined AWS API Gateway. If I enable CORS and give the access-control-allow-origin a definition of http://example.com , then I am able to access the Lambda instance from http://example.com . However, if I use https://example.com , it doesn't work. So in AWS, how can I define using multiple access-control-allow-origin values without using a wildcard? I tried using something like *.example.com , but that doesn't work. EDIT: If I use '*' as my