aws-api-gateway | complete AWS API Gateway Framework , powered by Serverless | REST library
kandi X-RAY | aws-api-gateway Summary
kandi X-RAY | aws-api-gateway Summary
The complete AWS API Gateway Framework, powered by Serverless Components.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of aws-api-gateway
aws-api-gateway Key Features
aws-api-gateway Examples and Code Snippets
Community Discussions
Trending Discussions on aws-api-gateway
QUESTION
Got an API Gateway v2 that is pointing at a Lambda that is running into CORS issues when I send a POST from a website running on localhost. As part of the troubleshooting I'm mimicking a preflight request with curl. It's not working how I'd expect.
Here is my CORS settings in API gateway (dev only, not prd):
CORS section of aws apigatewayv2 get-api --api-id=redacted
ANSWER
Answered 2021-Nov-17 at 19:18This came down to rejected headers. Short version: any rejected header in API Gateway will cause a 404. This is a working curl
:
QUESTION
The full path to the endpoint with the query string parameters is:
...ANSWER
Answered 2021-May-21 at 00:52let params = {};
let pathTemplate = '/getData';
let additionalParams = {
queryParams: {
param0: 'value0',
param1: 'value1'
}
};
QUESTION
According to https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-private.html it is possible to integrate API Gateway with an internal Application Load Balancer using a private VPC link.
However I cannot make it work.
I have a service accessible internally through the ALB. The ALB has no public IP, it balances requests in a AWS Fargate cluster (all within private subnets).
...ANSWER
Answered 2021-May-06 at 07:51I got it working. It is definitely possible to use API Gateway http integrated with a private (i.e: internal facing) ALB that balances traffic in private subnets.
The problem I had is that when I created the API in API Gateway through the console, there is an option to add integration, but that integration at that point only allows HTTP or Lambda, and I don't want that, I want a private integration using a VPC link I create in advance.
So here are the steps:
- Create (if non existing already) a security group that allows HTTP traffic on 80. This group will be associated later on to VPC link
- Create VPC link associated to the VPC and, explicitly, to the private subnets where the EC2services or fargate cluster are. Make sure you select the security group that allows HTTP traffic
- Create HTTP API in Apu Gateway. On the first step give it a name but DO NOT create an integration just yet. Skip that. Skip the route creation also. Choose a stage name or leave the
$default
(I use$default
and auto-deploy). - Create a route. If you want to accept anything, do so by choosing
ANY
and the path/{proxy+}
. - Finally, on that route, attach an integration. This time you'll see that there is an option to choose a private resource where you can explicitly select the private ALB with its http listener AND the VPC link created previously.
That's it. Http requests to Api Gateway will be directed to the private internal facing ALB.
QUESTION
I am facing this error XMLHttpRequest error.
while making an HTTP post call to my API-AWS API Gateway. My current Flow is Flutter web -> API gateway -> lambda -> rds.
I know there are already a couple of question-related to this like but as suggested in one of the answers to add some headers in response to lambda. but it doesn't work for me.
After doing some research I found out that the problem is regarding to CORS. now disabling cors in chrome is a temporary fix and suggested in this question.
some other solution that I found after researching suggested to enabled cors in my API and also in the frontend part I have added headers but none of them works.
...ANSWER
Answered 2021-Apr-27 at 13:26I have Solved my problem, and not going to delete this question because there aren't many well-defined solutions to this problem. For Future viewer who is using flutter web and AWS API-gateway.
- if you encounter this problem it means its from backend side not from flutter side
- XMLHttpRequest error. is caused due to CORS
The solution to the problem you have to enable CORS in api-gateway follow this link.
but if you are using proxy integration with lambda and api-gateway then in that case enabling CORS doesn't going to help, you have to pass on headers from the response of lambda function. like
QUESTION
I am creating a demo websocket API using AWS API Gateway onConnect and onDisconnect, I have attached Lambda functions
with code like
...ANSWER
Answered 2021-Apr-14 at 03:30Issue was with data returned from handlers which has to be in string format using JSON.Stringify and output returned from handler has to be in specific format.
QUESTION
I'm following this tutorial and I can get it all working just fine using the console. I've converted the SQS queue and API creation to CloudFormation, but can't get the API method integration to work. I've used Former2 to convert the working method to CloudFormation (shown below) but I continue to get this error:
...ANSWER
Answered 2021-Mar-22 at 21:14I think the trouble seems to me is coming from here
QUESTION
Im trying to send get request with JSON to AWS API gateway. This works fine from Postman, but when i try to send the same request using jquery i get error has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Ive enabled CORS from AWS and set the Access-Control-Allow-Origin to a wildcard.
I followed this guide https://medium.com/@peorth/using-jquery-to-access-a-aws-api-gateway-cors-afa11fd27f2a and added crossDomain: true
yet it changed nothing.
This is my jquery request:
ANSWER
Answered 2021-Feb-02 at 19:23You need to make sure that your request response matches the form:
QUESTION
Similar to this question, I would like to deny public access to an AWS API Gateway and only allow access when the API is invoked via a specific user account. I have applied the following resource policy to the gateway:
...ANSWER
Answered 2021-Jan-28 at 22:15Based on the comments.
The issue was that the stage was not re-deployed after adding/changing the policy.
So the solution was to re-deploy the stage for the policy to take effect.
QUESTION
Trying to send cookie back after login request on my hobby project website. For some reason it is working when running locally i.e. http://localhost:3000. But as soon as I push my API online and try to access it through my live website, I see no cookie under Application -> Cookies -> website (using chrome). I have googled a lot and I believe I have set check off every CORS policy.
The nodeJS is running in AWS lambda and is invoked through API gateway. API GW is directed to through a cloudfront distribution (if it matters).
In my express backend I have logged my headers accordingly:
...ANSWER
Answered 2020-Dec-19 at 12:28Turns out it wasn’t a CORS issue. I had simply forgotten to forward cookies from my cloudfront distribution.
QUESTION
What we are trying to do
We are trying to set up a very simple Geolocation service with API Gateway and Lambda.
Very similar to https://ipstack.com/, but we don't want to use an external service as we believe it could be an issue in some jurisdictions to send a non-anonymized IP address to a service we don't control (before getting the user's consent).
Would like to have a simple api https://location.my-site.com that returns the country (for GDPR, cookies, etc purposes).
Now it seems that there is a light Cloudfront behind API Gateway that would produce the header "Cloudfront-Viewer-Country", which would be very simple and achieve what we need. i.e. lambda receives Cloudfront-Viewer-Country and just sends it back.
What we have tried
I have seen solutions such as this one: Build a Geolocation API using AWS Lambda and MaxMind, but I struggle to see why deploying an RDS and maintaining the MaxMind database would make sense for us, if it is already available from Cloudfront-Viewer-Country.
I have seen this question: Accessing cloudfront-viewer-country header in AWS API Gateway using HTTP Proxy?, and tried implementing the answer from Michael - sqlbot. But I cannot seem to access the headers.
I have also tried what is suggested in this post, but I can't seem to access the value of Cloudfront-Viewer-Country either.
What we are doing (in conjunction with 'What we have tried')
To access and check if the header is available I am using the following python lambda function
...ANSWER
Answered 2020-Oct-14 at 20:19I was able to get access to Cloudfront-Viewer-Country by setting a Endpoint Type = Edge optimized.
I could not get it to work with Endpoint Type = Regional or with http api gateway.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install aws-api-gateway
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page