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

Invalid URL #36

Open snami100 opened 1 year ago

snami100 commented 1 year ago

Environment data

Expected behaviour

Should connect to JupyterHub

Actual behaviour

Doesnt connect, says invalid URL, when using 'Existing JupyterHub Server...' My URL looks like this: https://aubf-hig-start.apps.ocp4pbk.kernel.local/user/{username}?token={token}

When im using 'Existing Jupyter Server...' it says, use 'Existings JupyterHub Server...'...

DonJayamanne commented 1 year ago

Thanks for filling this issue and sorry you are running into this

Please can you provide a screenshot of the problem Can you also enable verbose logging for jupyterhub from the settings and replicate the issue again Then provide the output from the jupyterhub output panel

snami100 commented 1 year ago

I don't have the admin rights for this JupyterHub. On older versions i could connect, only on the newer version it was not possible.

DonJayamanne commented 1 year ago

Please can you share a screenshot of the problem

snami100 commented 1 year ago

When using JupyterHub Server grafik

When using Jupyter Server grafik

DonJayamanne commented 1 year ago

Thanks for the screenshots.

The second error is basically a message suggesting you use the new extension The first error is from the new extension, which is the right appraoch.

Screenshot 2023-02-04 at 09 24 37

How to get to the output?

Here's a screen sample Screenshot 2023-10-13 at 14 27 12

snami100 commented 1 year ago

11:44:51.853 [error] Error sending request to https://jhub-highmem-start.apps.ocp4pbk.versatel.local/user/hub/api FetchError: request to https://jhub-highmem-start.apps.ocp4pbk.testment.local/user/hub/api failed, reason: unable to get issuer certificate

at ClientRequest. (/home/snami100/.vscode/extensions/ms-toolsai.jupyter-hub-2023.10.1002881100/dist/extension.node.js:63581:18) type = system errno = UNABLE_TO_GET_ISSUER_CERT code = UNABLE_TO_GET_ISSUER_CERT 11:44:52.021 [error] Error sending request to https://jhub-highmem-start.apps.ocp4pbk.testment.local/hub/api FetchError: request to https://jhub-highmem-start.apps.ocp4pbk.testment.local/hub/api failed, reason: unable to get issuer certificate at ClientRequest. (/home/snami100/.vscode/extensions/ms-toolsai.jupyter-hub-2023.10.1002881100/dist/extension.node.js:63581:18) type = system errno = UNABLE_TO_GET_ISSUER_CERT code = UNABLE_TO_GET_ISSUER_CERT 11:44:52.188 [error] Error sending request to https://jhub-highmem-start.apps.ocp4pbk.testment.local/hub/api FetchError: request to https://jhub-highmem-start.apps.ocp4pbk.testment.local/hub/api failed, reason: unable to get issuer certificate at ClientRequest. (/home/snami100/.vscode/extensions/ms-toolsai.jupyter-hub-2023.10.1002881100/dist/extension.node.js:63581:18) type = system errno = UNABLE_TO_GET_ISSUER_CERT code = UNABLE_TO_GET_ISSUER_CERT 11:44:52.189 [error] Failed to determine base url for https://jhub-highmem-start.apps.ocp4pbk.testment.local/user/snur.amin?token=82b7e79f571a456d9f8d5c53715a3af9 Error: Unable to determine base url of Jupyter Hub Server at getJupyterHubBaseUrl (/home/snami100/.vscode/extensions/ms-toolsai.jupyter-hub-2023.10.1002881100/dist/extension.node.js:64314:9)

DonJayamanne commented 1 year ago

@snami100 Thanks for the logs and the screenshots. Based on the logs, it seems the certificate is not valid. I.e. the certificate used by the JupyterHub server Is this some self signed certificate or the like?

I've got a PR that would prompt the user to allow using such un'trusted certificates (but this is not recommended). However we have run into this in the past where users use self signed certificates, expired certifidates or the like like.

DonJayamanne commented 1 year ago

Please can you

If it works great, you can keep using this. I will ship a pre-release version of this extension once its merged into the main branch and will ship a new version in a week or two, along with the latest version of VS Code. ms-toolsai-jupyter-hub-insiders.vsix (1).zip

kalpanachinnappan commented 11 months ago

I am still seeing the "unable to get issuer certificate" error in v2023.10.1003012305 version of Jupyterhub extension.

fecorreiabr commented 11 months ago

I am facing similar issue. My company uses a custom CA to issue certificates, that's the cause of the error. Version v2023.10.1003012305. The log:

12:51:49.837 [error] Error sending request to https://XXXXXXXXXXXXX/hub/api FetchError: request to https://XXXXXXXXXXXXX/hub/api failed, reason: unable to verify the first certificate
    > at ClientRequest.<anonymous> (c:\Users\XXXXXXXXXXXXX\.vscode\extensions\ms-toolsai.jupyter-hub-2023.10.1003012305\dist\extension.node.js:63581:18)
    > type = system
    > errno = UNABLE_TO_VERIFY_LEAF_SIGNATURE
    > code = UNABLE_TO_VERIFY_LEAF_SIGNATURE
12:51:50.234 [error] Error sending request to https://XXXXXXXXXXXXX/hub/api FetchError: request to https://XXXXXXXXXXXXX/hub/api failed, reason: unable to verify the first certificate
    > at ClientRequest.<anonymous> (c:\Users\XXXXXXXXXXXXX\.vscode\extensions\ms-toolsai.jupyter-hub-2023.10.1003012305\dist\extension.node.js:63581:18)
    > type = system
    > errno = UNABLE_TO_VERIFY_LEAF_SIGNATURE
    > code = UNABLE_TO_VERIFY_LEAF_SIGNATURE
DonJayamanne commented 11 months ago

@fecorreiabr @snami100 @kalpanachinnappan

fecorreiabr commented 11 months ago

@DonJayamanne I found out my problem was in the reverse proxy (httpd) config. It needed the SSLCertificateChainFile option to force the server to send all the certificate chain in the SSL handshake. This is a node-related problem as described here. Now the connection to JupyterHub works as expected.

Straboxer commented 10 months ago

@DonJayamanne I have a similar problem, I have the jupyter.allowUnauthorizedRemoteConnection: true (and the pre-release version of JupyterHub and Jupyter) and I accept the popups saying it is a self signed certificate, but a Invalid Url always appear.

`10:56:03.239 [error] Error sending request to https://HOSTNAME:9443/hub/api FetchError: request to https://HOSTNAME:9443/hub/api failed, reason: self signed certificate

at ClientRequest. type = system errno = DEPTH_ZERO_SELF_SIGNED_CERT code = DEPTH_ZERO_SELF_SIGNED_CERT

10:56:04.801 [error] Failed to determine base url for https://HOSTNAME:9443/user/USER/?token=TOKEN Error: Unable to determine base url of Jupyter Hub Server

at getJupyterHubBaseUrl `

DonJayamanne commented 10 months ago

@Straboxer are you using vscode.dev or the like (i.e. are you using VS Code from within the browser)?

Straboxer commented 10 months ago

Hey @DonJayamanne I am using VS Code native app for Mac M1.

DonJayamanne commented 10 months ago

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

cchen777 commented 8 months ago

Hi @DonJayamanne , thanks for the great extension I'm facing the same issue to connect to a Jupyterhub URL , i've follow the steps you mentioned

Environment data

DonJayamanne commented 8 months ago

Please open the dev tools using the command Toggle Developer Tools

cchen777 commented 8 months ago

Hello @DonJayamanne , thanks for your response and sorry for the delay reply, i follow the steps again and sadly there's no console logging or network actively happen from the Developer Tools as the screenshot display, I enter multiple times URL and only see the Jupyterhub extension output keep printing Error: Unable to determine base url of Jupyter Hub Server, i did turn console log level to Verbose but still nothing appear there, I wonder if there's a way to show more logging from the jupyterhub vscode extension side for this case

Screenshot 2024-03-14 at 11 57 00 PM
DonJayamanne commented 8 months ago

@cchen777

cchen777 commented 8 months ago

What version of Jupyter Hub is that

we are using jupyterhub==3.1.1

Can you try the url without the trailing ? character

I tried and it didn't help 😞

kaigg96 commented 8 months ago

Hello @DonJayamanne, I'm facing what seems like the same issue.

I'm using Docker/Jupyterhub, attempting to connect to the server via my IP address with a SSL.

Opening the running server in my browser via the address (https://10.XXX.X.XX:8000) redirects me to login as it should, but connecting through VS Code gives an invalid jupyterhub url.

The log message is the same as well - [error] Failed to determine base url for https://10.XXX.X.XX:8000 Error: Unable to determine base url of Jupyter Hub Server.

It does, however, work when loading through https://localhost:8000 instead of through the IP address. I just need others to be able to connect, hence why I need it to work via my IP address instead.

I've attempted all the troubleshooting you described above, with the same outputs as @cchen777. Any help is appreciated!

VS Code 1.87.2 VS Code extension - Jupyter v2024.2.2024022602 (pre-release) VS Code extension - Jupyterhub v2023.10.1003492320 (pre-release) Jupyterhub version 4.1.0

lateo-net commented 7 months ago

Same issue : "Invalid JupyterHub URL specified"

VSCode : 1.87.2 Jupyter ext : 2024-02 JupyterHub ext : 2023-10-1003492320

JupyterHub :

URL in kernel selection : https://jupyter.{domain.tld}/user/{someone@gmail.com}/?token={TokenCreatedFromJupyterHubControlPanel}


For the record I have a working configuration for an air-gapped network (with private CA and different versions of almost everything).

DonJayamanne commented 7 months ago

@lateo-net @cchen777 @snami100 Please could you

lateo-net commented 7 months ago

@DonJayamanne Invalid JupyterHub URL specified.

Also tried to uninstall JupyterHub extension then install the insiders vsix and restart VSCode, no luck, same result.

From console dev tools while "create new notebook" :

event.ts:42 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
webviewElement.ts:511 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
index.html?id=8fddd2…tebookRenderer:1021 [Violation] Avoid using document.write(). https://developers.google.com/web/updates/2016/08/removing-document-write

No Console event while validating the URL of the JupyterHub server.

kaigg96 commented 7 months ago

@DonJayamanne

Here is the jupyterhub output for me:

13:16:44.366 [error] Error sending request to https://10.XXX.X.XXX:8000/hub/api FetchError: request to https://10.XXX.X.XXX:8000/hub/api failed, reason: self signed certificate

at ClientRequest. (c:\Users\XXXX.vscode\extensions\ms-toolsai.jupyter-hub-2024.4.100\dist\extension.node.js:63667:18) type = system errno = DEPTH_ZERO_SELF_SIGNED_CERT code = DEPTH_ZERO_SELF_SIGNED_CERT 13:16:53.022 [error] Error sending request to https://10.XXX.X.XXX:8000/hub/api FetchError: request to https://10.XXX.X.XXX:8000/hub/api failed, reason: self signed certificate at ClientRequest. (c:\Users\XXXX.vscode\extensions\ms-toolsai.jupyter-hub-2024.4.100\dist\extension.node.js:63667:18) type = system errno = DEPTH_ZERO_SELF_SIGNED_CERT code = DEPTH_ZERO_SELF_SIGNED_CERT 13:16:53.622 [error] Failed to determine base url for https://10.XXX.X.XXX:8000 Error: Unable to determine base url of Jupyter Hub Server at getJupyterHubBaseUrl (c:\Users\XXXX.vscode\extensions\ms-toolsai.jupyter-hub-2024.4.100\dist\extension.node.js:64409:9)

kaigg96 commented 7 months ago

I was able to fix my issue using the following steps:

add env var NODE_TLS_REJECT_UNAUTHORIZED=0 add "http.systemCertificates": true to vs code settings.json In vs code settings for Jupyter, check "Allow Unauthorized Remote Connection"

Then faced an authentication issue (in spite of using the dummy authenticator). Fixed by having the user log in through the browser. After that, their username/pw combo was accepted by VS code.

jamessong commented 7 months ago

add env var NODE_TLS_REJECT_UNAUTHORIZED=0

Where to set this?command line?

jamessong commented 7 months ago

Unable to determine base url of Jupyter Hub Server

at getJupyterHubBaseUrl The remote server works well with my desktop version of jupyterlab, so this is vscode or extention issue ....

Magic-Ludo commented 7 months ago

add env var NODE_TLS_REJECT_UNAUTHORIZED=0

Where to set this?command line?

In your .bashrc export NODE_TLS_REJECT_UNAUTHORIZED=0

The solution of @kaigg96 worked for me

PhenomenaPh commented 5 months ago

Still getting Unable to determine base url of Jupyter Hub Server error. Any solution to that problem? Tried every steps from this issue. Nothing seems to be working.

hankniel commented 5 months ago

I was able to fix my issue using the following steps:

add env var NODE_TLS_REJECT_UNAUTHORIZED=0 add "http.systemCertificates": true to vs code settings.json In vs code settings for Jupyter, check "Allow Unauthorized Remote Connection"

Then faced an authentication issue (in spite of using the dummy authenticator). Fixed by having the user log in through the browser. After that, their username/pw combo was accepted by VS code.

thank you bro. This solution worked for me

anisimov99 commented 4 months ago

In your .bashrc export NODE_TLS_REJECT_UNAUTHORIZED=0

I'm connecting from a Windows machine. Where am I supposed to find it? Is it ok to create it in a notebook session via %shell_env NODE_TLS_REJECT_UNAUTHORIZED=0? Because I've tried it, but it didn't help

hankniel commented 4 months ago

In your .bashrc export NODE_TLS_REJECT_UNAUTHORIZED=0

I'm connecting from a Windows machine. Where am I supposed to find it? Is it ok to create it in a notebook session via %shell_env NODE_TLS_REJECT_UNAUTHORIZED=0? Because I've tried it, but it didn't help

i think you just set the variable through cmd like set NODE_TLS_REJECT_UNAUTHORIZED=0

PhenomenaPh commented 3 months ago

Any progress on this issue? I can easily connect via pycharm jupyter connection but cant do the same with vscode. I get only Error: Unable to determine base url of Jupyter Hub Server

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

PhenomenaPh commented 3 months ago

@DonJayamanne

Ive done every step from your instruction. Here is the output: `[error] Failed to determine base url for {my hub url}: Unable to determine base url of Jupyter Hub Server

at getJupyterHubBaseUrl (/Users/rustemhutiev/.vscode/extensions/ms-toolsai.jupyter-hub-2024.5.100/dist/extension.node.js:64986:9)`

I have tried several urls:

Using the same url i can connect to the jupyterhub in Pycharm via 'Add jupyter connection' feature

image
DonJayamanne commented 3 months ago
  1. When entering the url , you do not need to include the username, etc/ Just jupyter_url (https://jupyter.{domain.tld}) is sufficient (exclude the trailing /user/{user_name}/lab)

  2. Also, can you try entering the following url in the browser and let me know what you get https://jupyter.{domain.tld}/hub/api

Let me know if that works, and I'll try to update the code to try and strip that out.

Also, can you share the rest of the logs, not just the error. I'd like to see what else is going on (if anything else is logged) Feel free to strip out any personal information from the logs.

PhenomenaPh commented 3 months ago

Hello! @DonJayamanne

Thank you for your fast feedback. When i type https://jupyter.{domain.tld}/hub/api i get {"version": "4.1.5"} As for (https://jupyter.{domain.tld}) i still get a basic error without any other logs: Error: Unable to determine base url of Jupyter Hub Server > at getJupyterHubBaseUrl (/Users/xxx/.vscode/extensions/ms-toolsai.jupyter-hub 2024.5.100/dist/extension.node.js:64986:9)

What else can i provide in order to give you full details on this issue

PhenomenaPh commented 3 months ago

For context: my URL is not starting with https://jupyter.{domain.tld}/... but rather https://ml-jupyterhub.{domain.tld}/ The subdomain in my case is 'ml-jupyterhub' instead of just 'jupyter'. This could be due to a specific configuration for a machine learning-focused JupyterHub instance in my organization. And if it is relevant, I think that it is configured via k8s.

AsyqD commented 4 days ago

I was able to fix my issue using the following steps:

add env var NODE_TLS_REJECT_UNAUTHORIZED=0 add "http.systemCertificates": true to vs code settings.json In vs code settings for Jupyter, check "Allow Unauthorized Remote Connection"

Then faced an authentication issue (in spite of using the dummy authenticator). Fixed by having the user log in through the browser. After that, their username/pw combo was accepted by VS code.

Thank U so much!