New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Authentication Token #20

Closed
joshuahoover opened this Issue Jun 10, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@joshuahoover

joshuahoover commented Jun 10, 2017

I'm getting the following error when I call "/" for the simple test app below

{"message":"Missing Authentication Token"}

api.py

from flask import Flask
app = Flask(__name__)

@app.route("/")
def index():
    return "INDEX"

@app.route("/cats")
def cats():
    return "Cats"

@app.route("/dogs/<id>")
def dog(id):
    return "Dog = " + str(id)

serverless.yml

service: example

provider:
  name: aws
  runtime: python2.7

plugins:
  - serverless-wsgi

functions:
  api:
    handler: wsgi.handler
    events:
      - http: ANY {proxy+}

custom:
  wsgi:
    app: api.app

Calls to /cats and /dogs/x work fine. Oddly, calling / from the API Gateway console returns successfully, but not when calling from curl or a web browser.

@logandk

This comment has been minimized.

Show comment
Hide comment
@logandk

logandk Jun 13, 2017

Owner

This is expected as {proxy+} (for unknown reasons) does not match /. You would need to match / explicitly:

functions:
  api:
    handler: wsgi.handler
    events:
      - http: ANY {proxy+}
      - http: ANY /
Owner

logandk commented Jun 13, 2017

This is expected as {proxy+} (for unknown reasons) does not match /. You would need to match / explicitly:

functions:
  api:
    handler: wsgi.handler
    events:
      - http: ANY {proxy+}
      - http: ANY /

@logandk logandk closed this Jun 13, 2017

@logandk logandk added the question label Jun 13, 2017

@jamy015

This comment has been minimized.

Show comment
Hide comment
@jamy015

jamy015 Jul 19, 2017

Shouldn't this be changed in the example or otherwise noted somewhere in the readme? The accompanying text for the example even says:

This configuration example treats API Gateway as a transparent proxy, passing all requests directly to your Flask application, and letting the application handle errors, 404s etc.

...which is obviously not true, because requests to / aren't passed directly to the Flask application.

jamy015 commented Jul 19, 2017

Shouldn't this be changed in the example or otherwise noted somewhere in the readme? The accompanying text for the example even says:

This configuration example treats API Gateway as a transparent proxy, passing all requests directly to your Flask application, and letting the application handle errors, 404s etc.

...which is obviously not true, because requests to / aren't passed directly to the Flask application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment