vscode-jupyter icon indicating copy to clipboard operation
vscode-jupyter copied to clipboard

Can't connect to remote Jupyter Server if auth is disabled

Open superlevure opened this issue 1 year ago • 1 comments

Environment data

  • VS Code version: 1.86.0
  • Jupyter Extension version (available under the Extensions sidebar): v2024.1.0
  • Python Extension version (available under the Extensions sidebar): v2024.0.1
  • OS (Windows | Mac | Linux distro) and version: macOS 10.15.7
  • Python and/or Anaconda version: Python 3.11
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Jupyter server running: Remote

Expected behaviour

I should be able to connect to a remote Jupyter server launched with no auth (--ServerApp.token='')

Actual behaviour

When I select the server, I get no output in the Jupyter VSCode extension (even after having set the logging level to VERBOSE and reloaded VSCode) and the following logs in the Jupyter server:

[W 2024-02-08 10:15:53.407 ServerApp] 404 GET /hub/api ([email protected]) 2.13ms referer=None
[W 2024-02-08 10:15:53.495 ServerApp] 404 GET /login? ([email protected]) 2.40ms referer=None

Steps to reproduce:

  1. Launch a Jupyter server with docker run -it --rm -p 8889:8888 quay.io/jupyter/base-notebook start-notebook.py --ServerApp.token=''"
  2. Try to connect to it via the VSCode extension with http://localhost:8889

Note 1: It works perfectly fine if I remove the --ServerApp.token=''" part and use a token instead. Note 2: I'm actually running the Jupyter server on a remote VM so the setup is slightly more complex than the one exposed above, but I don't think it's related to the issue anyway. Let me know if it's not reproducible though

Thank you for your help!

superlevure avatar Feb 08 '24 10:02 superlevure

Glad I found this issue before spending more time on figuring out why its not working for me!

basnijholt avatar Feb 08 '24 21:02 basnijholt

Also experiencing this issue with vscode 1.87.2 and vscode-jupyter v2024.2.2024022602 when using jupyter-notebook --NotebookApp.token='' --NotebookApp.password='' --no-browser

marklacroix avatar Mar 13 '24 13:03 marklacroix

Well this also fix the issue of the following in the logs when auth is disabled?

Password for http://localhost:<PORT>/ was invalid.

Also, even with the invalid message I can connect to a session but not to the kernel. When I try to connect to the kernel directly I get

00:24:10.238 [error] Error in execution (get message for cell) Error: Failed to connect to the remote Jupyter Server 'http://localhost:2556/'. Verify the server is running and reachable. ('_xsrf' argument missing from POST).
    > at au.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-darwin-arm64/dist/extension.node.js:311:2791)
    > url = http://localhost:2556/
    > serverProviderHandle = [object Object]
    > originalError = Error: '_xsrf' argument missing from POST
    > baseUrl = http://localhost:2556/

Also the password prompt comes up after only a compute of seconds after I click on the name of the remote host so hard to select session instead of kernel. Great progress though.

damienrj avatar Apr 04 '24 05:04 damienrj