7
votes

I am using API Gateway to build a REST API to communicate with a deployed aws sagemaker model via aws lambda. When I test the Method (Method Test Results) my lambda function returns the required results. I've definitely deployed the API and I'm using the correct invoke URL with the resource name appended (Method Invoke URL). Finally I have checked all the auth settings for this method request (Method Auth Settings). When I input the invoke URL into the browser or try to call the REST API (from cloud9 IDE -- a web app I am developing) I get this error: {"message":"Missing Authentication Token"} (URL Response)

My API is very simple, only one POST request, it does not contain any other resources or methods. I tried also setting up the method under '/' but had the same issue.

There are a lot of people out there with this issue, and I've spent a while reading through similar posts - but the solutions boil down to the issues I've checked above. If anyone could help it would be greatly appreciated!

Iain

4

4 Answers

8
votes

For the benefit of anyone else who's as silly as I am, the other reason you may get this error is that you're requesting a URL that isn't configured.

For instance, you've set up a proxy API on / that sends requests through to your backend, and the path to that is https://mumblemumble/prod, and you request https://mumblemumble/prod itself instead of https://mumblemumble/prod/your/resource, you'll get this error.

5
votes

You have configured the API Gateway resource with the POST method and when using the API Gateway console to test, the console handles setting the HTTP method to POST. However, when you directly hit the invoke URL from the browser, the GET method is used.

API Gateway by default returns the {"message":"Missing Authentication Token"} response for methods not defined or for paths not present, as given here

If API Gateway fails to process an incoming request, it returns to the client an error response without forwarding the request to the integration backend. By default, the error response contains a short descriptive error message. For example, if you attempt to call an operation on an undefined API resource, you receive an error response with the { "message": "Missing Authentication Token" } message.

Use the POST method to test your API. This can be done using the command-line (curl) or using Postman.

0
votes

Another potential reason is an error being thrown by the Lambda function code. I had a similar issue and it turned out to be a TypeError in my python code. You can check CloudWatch logs to gain more information.

0
votes

In my case, the url isn't the correct one. From Aws APIs, goto your api, goto the "stages" your method, find the "invoke URL", then use it in postman.