aws-api-gateway

AWS Lambda to run in background even after sending response to API Gateway

梦想与她 提交于 2019-12-04 17:04:07
问题 I have searched all through the net but didn't find a solution of how to make this functionality get succeeded. Require help. My requirement is: I want a that if I trigger an aws lambda function written in node.js and uses an aws-serverless-express module must send back response quickly to API gateway but still should not exit and still run in the backend and we could see cloud watch logs. It must be asynchronous. The code snippet is: app.get('/check', function(req, res){ method.invoke(req)

Random status code: 502 errors on AWS api gateway connected to lambda

时间秒杀一切 提交于 2019-12-04 16:46:29
问题 I have multiple lambdas exposed with api gateway using proxy integration. From time to time i'm getting strange errors with status code 502. There is nothing in lambda cloud watch logs. Below i posted api gateway logs for sample request: (0cbbd9f5-f1bd-11e7-92c0-4d5d3b7d0380) Received response. Integration latency: 231 ms (0cbbd9f5-f1bd-11e7-92c0-4d5d3b7d0380) Endpoint response body before transformations: { "Message": "An error occurred and the request cannot be processed.", "Type": "Service

how to make AWS api gateway accept http instead of https

江枫思渺然 提交于 2019-12-04 16:33:18
问题 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. 回答1: 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

How do I find the API endpoint of a lambda function?

梦想与她 提交于 2019-12-04 16:08:57
问题 I have a Lambda function that has an exposed API Gateway endpoint, and I can get the URL for that via the AWS console. However, I would like to get that URL via API call. Neither the Lambda API documentation nor the API Gateway documentation seem to have that information (or perhaps I've missed it), so is this even possible in the first place? 回答1: Your API Gateway endpoint URL doesn't get exposed via an API call. However, since the URL of the API follows a certain structure, you could get

Terraform not deploying api gateway stage

a 夏天 提交于 2019-12-04 14:07:11
问题 I have been trying to create an API Gateway endpoint using terraform. Everything seems to be working except the last part of deploying a stage. After I run terraform apply I go into the console and I find that the deployment has not happened. I need to manually click on Deploy Api in order to get it working. Here's the terraform file for the api gateway. variable "region" {} variable "account_id" {} resource "aws_api_gateway_rest_api" "online_tax_test_client_report_endpoint_api" { name =

Api Gateway can't invoke Lambda function

[亡魂溺海] 提交于 2019-12-04 13:57:14
Following this tutorial on AWS , I hit a roadblock when trying to test the api through the web console (as many others did): Thu Nov 10 22:54:48 UTC 2016 : Execution failed due to configuration error: Invalid permissions on Lambda function I've read every relevant post on SO and AWS forums I could find, but can't figure out how to grant permission to the API Gateway to invoke the Lambda function. JBaczuk Web Console Method: Thanks to this mate I found a quick fix: Go into the web console and select The resource method > Integration Request > Pencil next to Lambda Function > Check mark next to

AWS API Gateway Proxy Response failure/dropped

不打扰是莪最后的温柔 提交于 2019-12-04 13:27:08
Problem : AWS API Gateway Proxy is not passing back the response from my backend service when using Postman, but works on curl Description : I have a backend service that I want to exposed via AWS API gateway. The use of gateway in this case is purely as a HTTP proxy. So, Created a new API Set the Resource as "Proxy" using ANY Gave my backend service address Deployed it (No Auth required, but API Key is needed though) Could call my backend service from the deployment stage url successfully Create a custom domain using a CA cert Created an Alias on my DNS provider 1hr later the Domain is up and

How to Access header in AWS Lambda?

淺唱寂寞╮ 提交于 2019-12-04 13:03:20
问题 I am using AWS Api Gateway. I have created resource and method using API Gateway. I have created Lambda function for generating signed URL in json format to access s3 bucket via CloudFront. When I call lambda function using GET method. I pass "channekID" as a querystring. I want to send X-API-Key custom header as well for authorization. I have tried lot things but did not find any solution. How to send custom header in Lambda function?? and after accessing header value in Lambda How to

Amazon API Gateway IAM authenticated example with generated JS SDK

感情迁移 提交于 2019-12-04 12:54:45
I have created sample GET and POST APIs on Amazon API Gateway following their official documentation. I have generated JS SDK for these APIs, which I am using to call these APIs from a client-side JS file hosted on S3. This works flawlessly without any 'Authorization Type'. Now, when I set 'Authorization Type' for GET method as 'IAM', I am required to pass IAM credentials in order for it to work. In spite of passing my AWS account's root credentials, I am getting this in the response headers: x-amzn-ErrorType:InvalidSignatureException:http://internal.amazon.com/coral/com.amazon.coral.service/

Is it possible to add an HTTP header from AWS Custom Auth on API gateway?

送分小仙女□ 提交于 2019-12-04 12:15:49
问题 I am using Custom Auth on AWS API Gateway, but I would like to add an extra HTTP header depending on the result. Does anyone know if this is possible, or how to do it. If it is not, is there an idea of if or when this will be possible? Many thanks. 回答1: We recently added support for this. Docs should be up soon. Now you can return an object like this from the authorizer function: { "principalId": "xxxxxxxx", // The principal user identification associated with the token send by the client.