I have an API Gateway endpoint that proxies a Lambda function. When I test the endpoint in the console (a GET request), it works fine and returns the correct JSON.
When I try the same endpoint in the browser or Postman, it doesn't work. The error is:
server IP address could not be found
I have logs set up in CloudWatch for the API and nothing comes up, so it looks like the API is not even getting called.
I'm using the serverless framework with NodeJS. I've tried deleting my whole CloudFormation stack and redeploying from scratch but it didn't make a difference. The API was working fine until today.
I'm having the exact same issue. Specificially, Starbucks wifi doesn't like AWS API Gateway endpoints but quite a few other public wifi too. The solution is to use custom domain for the API Gateway endpoints, I'm afraid
Related
I'm looking after solution where AWS Api Gateway changes method endpoint Url dynamically.
I am familiar with stage variables and in Integration request I can change endpoint per method like (https://${stageVariables.Url}/api/DoSomething).
What I need is that information how parse endpoint is included in requests.
https://${RequestData.Url}/api/DoSomething
I have same Api in different locations and to implement centralized Api keys and logging services I try to forward all traffic through this one Api Gateway.
After first request client gets its endpoint information, but I don't know how to solve that clients next requests to Gateway should forward to that endpoint which client get earlier.
I got an answer from AWS support. They told that I have to make a lambda function to process all requests or just use Stage variables.
There's a lot of questions out there pertaining to "lambda" but I haven't touched that in my life, so it probably isn't relevant to this question.
All I've done so far is import a swagger json spec into AWS API Gateway and try my best to configure it to connect to my REST api.
My issue here is that when I try calling the API gateway endpoint through the test console, everything works as expected.
But then why I try querying the same endpoint from outside AWS like any end user, I get this nondescript 500 response.
The nifty thing is that since I own the backend service, I can see the logging, which clearly indicates that a successful 200 response was returned (which should be the json response shown in the first screenshot).
So now I know that it's AWS's fault that I'm getting a 500. But I'm honestly not sure what the issue could be.
Here are all relevant configuration screens for this particular endpoint.
Method Request
Integration Request
Integration Response
Method Response
If there's any screen/setting I didn't provide that would be helpful, just let me know.
TLDR, api gateway endpoint works in online console ui, but not in real life
I follows #MarkB's advice and linked API Gateway to an IAM role with permissions to write to Cloudwatch and then here's the kicker: you have to redeploy the stage to jumpstart Cloudwatch (this is actually very poorly documented, aws).
And when I found out that I had to redeploy the gateway, that's when I also conveniently discovered that for any of the configuration changes I was making to be applied, I actually had to redeploy the entire thing.
So after redeploying, everything started to work.
I am using VPC link in API GATEWAY to connect to rest service in EC2 instance. However, octet stream responses are not getting correctly passed through. Error getting at client side is "Make sure you are passing in a Gzip Stream". Do I need to make any changes in API gateway or in Spring REST service headers? REST service returns the correct response if invoked directly.
Hurray! Resolved it.
Added "Accept-encoding" : "identity" header in client side.
in API Gateway setting, enabled "content encoding".
worked like a charm :)
PS: Make sure you deploy the API even though it is just settings!!
I am fairly new to AWS Lambda but sure can see the benefits of it and stumbled upon the superb framework Serverless to help me built solutions on Lambda.
I started out building solutions using AWS API Gateway but really need "internal" VPC API's and not public Internet facing API's like API GW creates.
I found that Servless indeed can expose a HTTP endpoint but I can't figure out how this is done and how the URL is created.
When I deploy the Lambda from Serverless it gives me the URL, e.g.:
https://uxezd6ry8z.execute-api.eu-west-1.amazonaws.com/dev/ping
I would like to be able to find (or create) this same http listener for already existing Lambdas so my question is how is the URL created and where is teh actual HTTP listener deployed?
You might be looking for the invoke url,
1. go to https://console.aws.amazon.com/apigateway
2. select api link (which you have deployed on aws lambda).
3. select stages in left side panel and
see the invoke url.
Adding a http listener can be done by going to your lambda function, selecting the 'triggers' tab and 'add trigger', finally selecting API Gateway - but as others mentioned this does create a public facing url.
Duh, I was in the wrong AWS logon previously so the API GW was not showing any matching Serverless API and that was why I couldn't understand how they did it...
Once I logged into the AWS account that hosts the Serverless structure I can see the API GW GET API's for the Serverless HTTP listener.
I created an API with AWS API Gateway. This API provides a method that calls an AWS Lambda function. When I call this API method manually using a REST client, it works properly, and the Lambda function is called.
I also have a device that periodically pushes some data to a server via HTTP(S). When configured to push data to a HTTPS server running on an EC2 instance, it works properly. But when I configure the device to push data to API Gateway, the Lambda function is never called.
I tried sniffing the traffic via WireShark, and I can see that requests are indeed sent by the device and that the API responds, but I can't view the contents of the requests and responses since they are encrypted. My guess is that API Gateway returns somme kind of error that prevents the Lambda to be called. Unfortunately, the device does not provide any logs. Is there any way on AWS side to see what is going on?
Enable CloudWatch Logs for API Gateway: https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cloudwatch-logs/