microsoft / vscode-jupyter-hub

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

Can't connect to jupyterhub #45

Closed lifetooeasy closed 4 weeks ago

lifetooeasy commented 10 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 9 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 9 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 8 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 8 months ago

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

quantum-byte commented 7 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 7 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 7 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 4 months 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 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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.

lifetooeasy commented 3 months ago

@DonJayamanne

dorsegal commented 3 months ago

I had the same issue Error: '_xsrf' argument missing from POST. took this fix https://github.com/microsoft/vscode-jupyter-hub/pull/65 and now I have another error.

Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffe

DonJayamanne commented 3 months ago

@dorsegal you are running into the issue https://github.com/microsoft/vscode-jupyter-hub/issues/64

dorsegal commented 3 months ago

I tried the work around but I have the same result.

Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer

Yefee commented 3 months ago

I tried the work around but I have the same result.

Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer

This is something I also encountered.

Although I have found a workaround, it is still painful to repeat the process every time. Follow these steps: 1) Open JupyterHub in your browser and terminate the current kernel. 2) Return to VS Code and click "Restart" at the top of the notebook. 3) Run the notebook again and you've bypassed this error from now on. For every notebook, you have to repeat this process 😫.

nitzanvolman commented 2 months ago

we have this issue as well, I can confirm this workaround works (pretty annoying)

Cursor Version: 0.40.4 VSCode Version: 1.91.1

JupyterHub Extension Version: v2024.5.1002432242

JupyterLab Version: Version 4.0.12

jaymc-arg commented 1 month ago

I tried the work around but I have the same result. Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer

This is something I also encountered.

Although I have found a workaround, it is still painful to repeat the process every time. Follow these steps: 1) Open JupyterHub in your browser and terminate the current kernel. 2) Return to VS Code and click "Restart" at the top of the notebook. 3) Run the notebook again and you've bypassed this error from now on. For every notebook, you have to repeat this process 😫.

@Yefee does not works when running kernel on .py documents with code selection for execution. VS Code Insiders sets the kernel selection to Python REPL when executing code. Image

EDIT: made a mistake, dismiss comments

DonJayamanne commented 1 month ago

HI everyone, I'm sorry you have been running into this issue. A fix has been shipped, however you'll need to install VS Code insiders and the latest pre-release version of the Jupyter extension. Please could you install that and let me know how that goes.

jaymc-arg commented 1 month ago

I't working for me, thank you so much for your work @DonJayamanne

Yefee commented 1 month ago

Thanks for update @DonJayamanne. The error persists in VS code insider + Jupyter v2024.10.2024101001 (pre-release) + Jupyter Hub v2024.10.1002831100 (pre-release)

09:15:17.773 [error] Error in websocket [Error: Server sent no subprotocol
    at ClientRequest.<anonymous> (/glade/u/home/~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-hub-2024.10.1002831100/dist/extension.node.js:6406:11)
    at ClientRequest.emit (node:events:519:28)
    at TLSSocket.socketOnData (node:_http_client:591:11)
    at TLSSocket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23)]
09:15:18.006 [info] Started session for kernel connectToLiveRemoteKernel:65d91870-622a-4418-93a3-313ac3192dfe
09:15:18.011 [info] Kernel successfully started
09:15:18.141 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.142 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.143 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.144 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.145 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.165 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.177 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.178 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.179 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.182 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.184 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.185 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.186 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.187 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.188 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.196 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.202 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.203 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.203 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
09:15:18.204 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
DonJayamanne commented 4 weeks ago

@Yefee Please can you try 2024.10.2024101501

Going to close this for now, as the pre-release should fix this. If not, please do ping here and i'll look into this.

Yefee commented 3 weeks ago

@DonJayamanne thanks for the following up.

I tried 2024.10.2024101501 and 2024.11.2024102401. Same error persists.

15:09:34.129 [info] Starting Kernel () for '~/work/projects/SST-bias/test_dataspell.ipynb' (disableUI=true)
15:09:34.634 [error] Error in websocket [Error: Server sent no subprotocol
    at ClientRequest.<anonymous> (/glade/u/home/~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-hub-2024.10.1002831100/dist/extension.node.js:6406:11)
    at ClientRequest.emit (node:events:519:28)
    at TLSSocket.socketOnData (node:_http_client:591:11)
    at TLSSocket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23)]
15:09:34.868 [info] Started session for kernel connectToLiveRemoteKernel:c7abf360-82bd-44f1-a830-e38153c22ee4
15:09:34.875 [info] Kernel successfully started
15:09:35.139 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
15:09:35.140 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
15:09:35.141 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
15:09:35.142 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
15:09:35.143 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
15:09:35.153 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer
15:09:35.160 [error] Exception while handling messages: TypeError: First argument to DataView constructor must be an ArrayBuffer