-
Notifications
You must be signed in to change notification settings - Fork 6
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
Jupyterhub kernel access no longer works for users with certain special characters in their username #53
Comments
Thank you very much for the detailed analysis, and providing the great sample for being able to easily repro this. |
@quantum-byte |
Hi @DonJayamanne , thanks for looking into it so quickly!
I tested it and i can execute my Test Notebook successfully as far as i can see. But i still see a few Errors in the As an example for one of the urls if i use the adjusted
I am also quite surprised, that the bugfix needed to be done in the jupyterhub extension. I guess i did not understand your sourcecode well enough as i though :). Output for
|
Your assessment was accurate, however I didn't want to modify the Jupyter extension to get around the issue with the Jupyter Hub problem. Here's the solution that keeps this fix in the Jupyter Hub extension #52
You can ignore this logged error, its a noop, it should work, please test and let me know if plotly widgets work/or not. |
Right, that totally makes sense! Fix it where the responsibility lies.
Its not quite a noop as far as i can tell. In the end it works in both cases since the fallback is to download the extension code from the cdn. But it still is a inconsistent behaviour since for "normal" usernames without special characters the extension code is downloaded from the Jupyterhub instance itself instead of the cdn. I opened a separate Ticket for it: #55 |
With newer
vscode-jupyter
extension versions thanv2023.9.1102792234
, it is no longer possible to access / use Jupyterhub kernels for Jupyterhub users with special characters in their username likeuser (test)
.Its the same issue somebody raised in issue 15055 as far as i can see but this one was closed.
This issue is also not in the separate
ms-toolsai.jupyter-hub
extension. The authentication works fine but the subsequent kernel iteration throughvscode-jupyter
breaks.Environment data
v2023.9.1102792234
e.g.v2024.2.0
Expected behaviour
The specific Jupyterhub user can login via the web ui and their server instance is started.
They then can use the Jupyterhub Server URL, username and generated token to setup a new Jupyterhub connection to access and use the kernels there in VSCode. Finally they can use one of the shown kernels to execute a example Notebook.
This also works if one uses
vscode-jupyter
extension versionsv2023.9.1102792234
.Actual behaviour
The specific Jupyterhub user can login via the web ui and their server instance is started.
They then can use the Jupyterhub Server URL, username and generated token to setup a new Jupyterhub connection to access and use the kernels there in VSCode.
Get an error
Cant connect to Remoteserver
after the Jupyterhub connection setup is complete and i cant see any kernels from the remote server to use. You can find the complete Extension Output at the bottom.The relevant line from the output is
http://localhost:8000/user/user%20(test)/api/kernels?1711536811205
. What works and what the Jupyterhub expects ishttp://localhost:8000/user/user%20%28test%29/api/kernels?1711536811205
.I am unsure if the error is only due to our use of the Jupyterhub separate proxy deployment or if the Jupyterhub internal proxy also has this issue, but it is very likely.
The fact is that jupyterhub encodes every special character except
~
and@
for the username and expects the username to be encoded in request paths like that. This can partially be seen here and here. For some background behind this behaviour i found also this issue which talks about it.Basically what happens then is, that the Jupyterhub proxy knows to redirect a request for
http://localhost:8000/user/user%20%28test%29/
but not forhttp://localhost:8000/user/user%20(test)/
. That is why we see the 404 error in the log output.My best guess is you broke this with microsoft/vscode-jupyter@4b47894 by no longer encoding some characters in the whole base url which also contains the username. But i think it was also not fully consistent with how Jupyterhub expects everything to be encoded before.
Also as far as i could see the
vscode-jupyterhub
extension is not affected by this issue because they retrieve the user infoserver
property from the Jupyterhub server and build the server user instance url by appending it to the base url as can be seen here (At least in the happy path where the Jupyter server returns theserver
property for the user. The fallback implementation looks buggy). The Jupyterhub user infoserver
property contains the correctly encoded username.Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
Setup or use a local or remote Jupyterhub instance. Login in and start the server with a user called
user (test)
. This is quite easy to simulate with theDummyAuthenticator
authenticator module which allows any kind of username to be tested.Setup a API Tokens for authentication on the Jupyterhub instance
Use the url, user name and token and create a new remote Jupyterhub connection
existing Jupyterhub-Server
enter URL for existing Server
http://localhost:8000
user (test)
JupyterHub (test)
Cant connect to Remoteserver
. See also the image (its in german though)Logs
Output for
Jupyter
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toJupyter
)The text was updated successfully, but these errors were encountered: