mamba-org / gator

Conda environment and package management extension from within Jupyter
Other
262 stars 29 forks source link

Fixing the url to be called for api status /api/v1/ #176

Closed costrouc closed 2 years ago

costrouc commented 2 years ago

For now Conda-Store is using Flask for the web server. It redirects requests that don't correctly match to a close matching one. E.g. /api/v1 -> /api/v1/. When using https this results in a CORS error. Here is the url that is set in conda-store https://github.com/Quansight/conda-store/blob/main/conda-store-server/conda_store_server/server/views/api.py#L99.

image

github-actions[bot] commented 2 years ago

Binder :point_left: Launch a binder notebook on the branch costrouc/gator/fix-conda-store-urls

peytondmurray commented 2 years ago

Hey, I just saw this. The problem only exists inside the condaStoreServerStatus function, where a request is set to the URL provided by getServerUrl(baseUrl). While this change fixes that specific request, it makes the requests for all the other endpoints have an extra / in them - for example, the endpoint targeted by fetchEnvironments is ${getServerUrl(baseUrl)}/environment/?page=${page}&size=${size}, which becomes https://localhost:5000//environment/?page=${page}&size=${size} in my local environment. Does that extra slash matter here?

Another approach would be just to explicitly put the / where it should be in the condaStoreServerStatus function.

fcollonval commented 2 years ago

Another possibility is to use the current fix and use URLExt.join from @jupyterlab/coreutils that will take care of joining URL part without duplicated slashes.

fcollonval commented 2 years ago

Closing following #177