microsoft / vscode-jupyter-hub

Jupyter Hub Support in VS Code
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter-hub
MIT License
8 stars 6 forks source link

Can't connect to jupyterhub #45

Open lifetooeasy opened 6 months ago

lifetooeasy commented 6 months ago

Environment data

Expected behaviour

Connect jupyterhub session via vscode jupyterhub extension.

Actual behaviour

Invalid username or password.

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

As described in the doc.

Logs

Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)

``` 12:17:34.165 [error] Failed to start the Jupyter Server Error: Failed to fetch user info, Internal Server Error (500) with message {"status": 500, "message": "error"} > at startServer (/.vscode/extensions/ms-toolsai.jupyter-hub-2023.10.1003492320/dist/extension.node.js:64252:9) ```

DonJayamanne commented 6 months ago

Thanks for filing this issue and sorry you are running into this issue. Are you still running into this issue? What version of Jupyter Hub do you have installed? Can you verify you can log into Jupyter hub via the browser?

lifetooeasy commented 5 months ago

@DonJayamanne Unfortunately, I still have this issue I am running jupyterhub 1.5.0 and yes I can log in to jupyterhub.

lifetooeasy commented 4 months ago

@DonJayamanne I am running version 2.3.1 of jupyterhub now and still have same issue, do you don't think that the new versions of vscode or vscode-jupyter-hub are the cause of this issue?

lifetooeasy commented 4 months ago

could be related to microsoft/vscode-jupyter#39 ?

quantum-byte commented 4 months ago

@life Because i was looking into a similiar issue just now.

Are there any special characters in the Jupyterhub username or what does your Jupyterhub user specific instance url look like ?

DonJayamanne commented 4 months ago

@quantum-byte @lifetooeasy Please can you install this version of Jupyter Hub extension, & let me know if this works for you.

ms-toolsai-jupyter-hub-insiders.vsix.zip

lifetooeasy commented 4 months ago
11:07:53.330 [debug] 
11:07:53.455 [debug] Error: Failed to get user info, Internal Server Error (500) with message  {"status": 500, "message": "Internal Server Error"}
    > at getUserInfo (/home//.vscode/extensions/ms-toolsai.jupyter-hub-2024.4.100/dist/extension.node.js:66986:9)
11:07:53.641 [debug] 
11:07:53.641 [debug] 
11:07:53.644 [debug] 
11:07:53.886 [error] Failed to get user info Error: Failed to get user info, Forbidden (403) with message  {"status": 403, `message": "Forbidden"}
    > at getUserInfo (/.vscode/extensions/ms-toolsai.jupyter-hub-2024.4.100/dist/extension.node.js:66986:9)
11:07:53.887 [debug] 
11:07:54.024 [debug] Error: Failed to get user info, Internal Server Error (500) with message  {"status": 500, "message": "Internal Server Error"}
    > at getUserInfo (vscode/extensions/ms-toolsai.jupyter-hub-2024.4.100/dist/extension.node.js:66986:9)
11:07:54.239 [debug] 
11:07:54.240 [error] Failed to get the user Jupyter Url TypeError: Cannot read properties of undefined (reading 'length')
    > at getUserInfo (/.vscode/extensions/ms-toolsai.jupyter-hub-2024.4.100/dist/extension.node.js:66979:77)
11:07:55.625 [error] SessionManager cannot enumerate kernelSpecs. Specs undefined.
11:07:55.629 [error] Uri verification error Error: Failed to enumeration kernel Specs
    > at /.vscode/extensions/ms-toolsai.jupyter-hub-2024.4.100/dist/extension.node.js:67150:21
liudaolunboluo commented 6 days ago

I'm having the same problem, I reinstalled using visx and still have the same problem, my username has no special characters and I'm pretty sure I can log in in my browser!

DonJayamanne commented 1 day ago

Please can you

ms-toolsai-jupyter-hub-insiders.vsix.zip

Screenshot for enabling logging

Image

To get to the logs, please open the bottom output panel (use the command Outupt: Focus Output View) & then select JupyterHub

Image

lifetooeasy commented 1 day ago

@DonJayamanne vscode can connect to remote server and list the available remote kernels. When I click on one of them the kernel is enabled BUT when I try to execute a cell I got this:

10:21:49.318 [info] Starting Kernel python3 for 'Untitled-1.ipynb' (disableUI=false)
10:21:49.876 [error] Failed to change kernel, re-throwing Error: '_xsrf' argument missing from POST
    > at new n (/home/~/.vscode/extensions/ms-toolsai.jupyter-2024.6.0-linux-x64/dist/extension.node.js:98:4480)
    > originalException = Error: '_xsrf' argument missing from POST
10:21:49.884 [warn] Error occurred while trying to start the kernel, options.disableUI=false Error: Failed to connect to the remote Jupyter Server. Verify the server is running and reachable. ('_xsrf' argument missing from POST).
    > at Qc.create (/home/~/.vscode/extensions/ms-toolsai.jupyter-2024.6.0-linux-x64/dist/extension.node.js:285:2808)
    > serverProviderHandle = [object Object]
    > originalError = Error: '_xsrf' argument missing from POST
10:21:49.888 [warn] Kernel Error, context = start Error: Failed to connect to the remote Jupyter Server. Verify the server is running and reachable. ('_xsrf' argument missing from POST).
    > at Qc.create (/home/~/.vscode/extensions/ms-toolsai.jupyter-2024.6.0-linux-x64/dist/extension.node.js:285:2808)
    > serverProviderHandle = [object Object]
    > originalError = Error: '_xsrf' argument missing from POST
DonJayamanne commented 1 day ago

How have you started Jupyter hub? Is this locally installed?

If so please can you share the details of the versions of Jupyter hub and other packages

lifetooeasy commented 1 day ago

I am trying to connect to a remote jupyterhub not locally. It runs jupyterhub version 4.1.5 and jupyterlab 4.2.2.

DonJayamanne commented 15 hours ago

Found the reason

(Below, notes for personal use)

See here https://jupyterhub.readthedocs.io/en/latest/explanation/singleuser.html

By default, jupyter-server uses its own cookie to authenticate. If that cookie is not present, the server redirects you a login page and asks you to enter a password or token.

As a result of this, the WebSocket also needs the headers (in particular the Cookie) Without this, the websocket request is deemed un-authenticated and a 403 error is returned, thus the websocket handshake fails.

DonJayamanne commented 14 hours ago

@lifetooeasy Please try installing this VSIX, should fix the issue & thanks a lot for your patience and help with this issue.

ms-toolsai-jupyter-hub-insiders.vsix (1).zip

DonJayamanne commented 13 hours ago

@lifetooeasy I think i have a better understanding of the issue now. Do you have any idea how the remote JupyterHub server has been configured.