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

Base path in server url or parameter not correctly handled #1823

Closed
previ opened this issue Dec 2, 2023 · 1 comment · Fixed by #1833
Closed

Base path in server url or parameter not correctly handled #1823

previ opened this issue Dec 2, 2023 · 1 comment · Fixed by #1833

Comments

@previ
Copy link

previ commented Dec 2, 2023

Description

OpenAPI definitions with server url with a base path (example: "http://localhost:8080/v1" are not correctly handled (error 404 or 500).

Expected behaviour

Correctly handle the API with full path (server url + API path)

Actual behaviour

Server raise exception, return 404 error code (or 500 in running with uvicorn):

% curl http://localhost:8080/v1/hello/world
{"type": "about:blank", "title": "Not Found", "detail": "Not Found", "status": 404}

or with uvicorn:

{"type": "about:blank", "title": "Internal Server Error", "detail": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.", "status": 500}

Steps to reproduce

Use the code in this gist, run it with the command:

connexion run openapi.yaml --host 0.0.0.0 --port 8080

or

uvicorn main:app --host 0.0.0.0 --port 8080

Additional info:

It works if the server url is amended with base path and the base path "v1" is put in the API path.

Output of the commands:

  • python --version Python 3.11.6
  • pip show connexion | grep "^Version\:" Version: 3.0.3
@k-c-p
Copy link

k-c-p commented Dec 4, 2023

Seems to be caused by starlette 0.33.0 which was released a few days ago.
Downgrade to 0.32.0.post1 make it work again.

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

Successfully merging a pull request may close this issue.

2 participants