Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS API Gateway won't open up

I created a "hello world" lambda function and then deployed it to an end-point using AWS's API Gateway:

config settings

All very much basic settings but I was sure to change the security to "open" and while i was told that it could take up for 15 minutes for the domain to resolve I found that even after 30 I was getting the following response from the "open" end-point:

 {"message":"Missing Authentication Token"}

Am I missing something obvious? Shouldn't this have been available with what I did?


Note, it was pointed out that this image is of a PUT not a GET. I tried both and both came back errors. Just to check I've run GET and PUT through Postman and get a similar but not identical response:

PUT

and then GET ...

GET

When I test the lambda function in the console it runs successfully but running it in the API Gateway it gives me a different articulation of the same error:

Tue Sep 29 20:57:43 UTC 2015 : Execution failed due to configuration error: Invalid permissions on Lambda function

and yet I used the default permissions that the console suggested. The lambda function itself is very basic and can be found here: code

like image 729
ken Avatar asked Sep 29 '15 20:09

ken


People also ask

How do I know if my API gateway is working?

Test a method with the API Gateway consoleSign in to the API Gateway console at https://console.aws.amazon.com/apigateway . Choose a REST API. In the Resources pane, choose the method you want to test. In the Method Execution pane, in the Client box, choose TEST.

Can API gateway fail?

Handling API Gateway 502 Error: Bad Gateway A 502 error code is related to the service your API Gateway integrates with. It means that API Gateway couldn't understand the response. For example, when you throw an error in a Lambda function or the resolved value has an invalid structure, it can lead to a 502 error.


2 Answers

I was having the exact some problem today. Whatever I did didn't work but finally figured out. turns out in order for the changes to take effect, you need to Deploy API.

So first go to Resources and click on Deploy API button. It will ask for a deployment stage. Once deployed I could call my API without any issues.

I know it's been a while since you posted the question, but thought it might come in handy for other people as well.

like image 108
Volkan Paksoy Avatar answered Sep 28 '22 03:09

Volkan Paksoy


I had this same issue with a deployed API that was being hit frequently around midday the requests would stop working and fail with { Missing Authentication Token }

My issue was not the URL or a stage that was not deployed but I do know AWS throws that error for both of those reasons.

However I found a command to invalidate the cache of apigateway because in my case I was using a custom domain attached to cloudfront.

aws apigateway flush-stage-cache --rest-api-id 97y41psdkg --stage-name dev

After running this I stopped getting the { Missing Authentication Token }

like image 29
David Webster Avatar answered Sep 28 '22 02:09

David Webster