Skip to content
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

swagger UI send request to endpoint without stage and return 403 #10

Open
kingkenmark opened this issue Jan 2, 2020 · 1 comment
Open

Comments

@kingkenmark
Copy link

I managed to create and deploy an application to AWS via this sls-flask service, but the swagger generated doesn't work, after enable the developer tools on Chrome, I found click the execute on swagger, it sends the request to an endpoint with stage, for example:

After "sls deploy -s dev", the output will contain the endpoint which looks like:
https://xxxxxx.execute-api.ap-southeast-2.amazonaws.com/dev

And the swagger page can be accessed via:
https://xxxxxx.execute-api.ap-southeast-2.amazonaws.com/dev/api/swagger

But when click the "execute" for api "/api/auth/login", the request will be sent to:
https://xxxxxx.execute-api.ap-southeast-2.amazonaws.com/api/auth/login
and it return "403" {"message":"Forbidden"}

If the request is sent to https://xxxxxx.execute-api.ap-southeast-2.amazonaws.com/dev/api/auth/login, it works.

If I change the Blueprint "url_prefix="/api/auth" to "url_prefix="/dev/api/auth", it still doesn't work since now the correct endpoint should be https://xxxxxx.execute-api.ap-southeast-2.amazonaws.com/dev/dev/api/auth/login.

It looks like when sls-flask generate the swagger, it ignores the stage.

@revmischa
Copy link
Member

The cause of this: jmcarp/flask-apispec#124
PR: jmcarp/flask-apispec#125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants