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

conda tab in classical notebook pod spawned from Jupyterhub has unwanted warnings. #47

Closed
HCharlie opened this issue Jun 29, 2020 · 5 comments · Fixed by #49
Closed

Comments

@HCharlie
Copy link

Description

In the classical notebook server(pod) spawned from Jupyterhub, when I click the Conda tab, it will pop up a warning window telling me an error An error occurred while retrieving package information.
Screen Shot 2020-06-29 at 10 34 55 PM

Reproduce

I was following Zero to JupyterHub with Kubernetes(https://zero-to-jupyterhub.readthedocs.io/en/latest/index.html) and using KIND(https://kind.sigs.k8s.io/docs/user/quick-start/) to set up the k8s cluster.

And the singleuser image I use is base-notebook from docker-stacks(https://github.com/jupyter/docker-stacks/blob/master/base-notebook/Dockerfile) with modification only to install jupyter_conda package.

After everything is setup. Just go to classical notebook and click Conda tab, you would see the window pop up.

Expected behavior

No warning shows up.

Context

  • Helm chart version:
    Jupyterhub: 0.8.2
  • Python package version:
    jupyter_conda: latest

What I see

b0231e00-ba21-11ea-9887-7869b1ac8067

in which test.hub.kind.test 127.0.0.1 in /etc/hosts

the request URL somehow end up with /hub/conda/task/... instead of /user/username/conda/task/... with which using wget will not give 404 code.

@fcollonval
Copy link
Member

@HCharlie Thanks for reporting the error. The redirection url is used there (for the classical notebook): https://github.com/fcollonval/jupyter_conda/blob/master/jupyter_conda/static/models.js#L138

I have never seen an error before - but I'm not using JHub often - and certainly not on Kubernetes unfortunately.

The redirected url is built on that line: https://github.com/fcollonval/jupyter_conda/blob/master/jupyter_conda/handlers.py#L141

As you can see it is only partial. Could you test the following change on jupyter_conda/static/models.js#L138:

-             xhr.getResponseHeader("Location") || url,
+             (urls.base_url + xhr.getResponseHeader("Location")) || url,

@HCharlie
Copy link
Author

HCharlie commented Jul 20, 2020

@fcollonval Thanks for your reply. And unfortunately, the above solution is not working, but I think we are getting close. The new url is illustrated below.
Screen Shot 2020-07-20 at 3 22 47 PM

Originally we were lacking the base url /user/chhan part, after the modification, we make the /conda/tasks/{id}?_={some digits} part broken.
is there a way to replace null?_=1595251318851 with conda/tasks/1?_=1595251318851?

@fcollonval
Copy link
Member

Sorry, I wrote the correction too quickly. The following should be better:

-             xhr.getResponseHeader("Location") || url,
+             xhr.getResponseHeader("Location") ? (urls.base_url + xhr.getResponseHeader("Location")) : url,

@HCharlie
Copy link
Author

HCharlie commented Jul 21, 2020

np :), this time it's working 🎆 , no more warning pop up at the beginning after clicking conda tab. While after clicking the + sign to create a new conda environment, there is a double slash in the URL like thishttp://test.hub.kind.test:8000/user/chhan//conda/tasks/2?_=1595321968764, but this works without any warning.

@fcollonval
Copy link
Member

Thank for helping getting to the bottom of this bug.

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