Skip to content
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

Invalid URL #36

Open
snami100 opened this issue Oct 12, 2023 · 42 comments · Fixed by #40
Open

Invalid URL #36

snami100 opened this issue Oct 12, 2023 · 42 comments · Fixed by #40
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@snami100
Copy link

Environment data

  • VS Code version: 1.83.1
  • Jupyter Extension version (available under the Extensions sidebar): v2023.10.1002861100
  • Python Extension version (available under the Extensions sidebar): v2023.10.1002861100
  • OS (Windows | Mac | Linux distro) and version: Windows 10

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...'...

@snami100 snami100 added the bug Issue identified by VS Code Team member as probable bug label Oct 12, 2023
@DonJayamanne
Copy link
Collaborator

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

@DonJayamanne DonJayamanne added the info-needed Issue requires more information from poster label Oct 12, 2023
@snami100
Copy link
Author

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
Copy link
Collaborator

Please can you share a screenshot of the problem

@snami100
Copy link
Author

When using JupyterHub Server
grafik

When using Jupyter Server
grafik

@DonJayamanne
Copy link
Collaborator

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.

  • Please could you install the latest pre-release version of the Jupyter and JupyterHub extension.
  • Open the extensions page, search for Jupyter and click the button Switch to Pre-Release Version
  • Similarly please install the latest Pre-Release version of the JupyterHub extension

Screenshot 2023-02-04 at 09 24 37

How to get to the output?

  • Select the command View: Toggle Output
  • The output panel will appear at the bottom (where terminals are dispaleyd0
  • From the dropdown select the JupyterHub item
  • Copy all of the output and paste it here

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

@DonJayamanne DonJayamanne self-assigned this Oct 13, 2023
@snami100
Copy link
Author

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
Copy link
Collaborator

@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
Copy link
Collaborator

Please can you

  • Download the following file
  • Extract it
  • Go into VS Code and select Extensions: Install from VSIX
  • When prompted, please reload VS Code
  • Try this new extension and let me know how things go

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
Copy link

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

@DonJayamanne DonJayamanne reopened this Dec 6, 2023
@fecorreiabr
Copy link

fecorreiabr commented Dec 13, 2023

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
Copy link
Collaborator

@fecorreiabr @snami100 @kalpanachinnappan

  • Please can you try installing the latest pre-release version of the extension
  • Also, please add the following setting jupyter.allowUnauthorizedRemoteConnection: true into VS Code and let me know if this works.
    Screenshot 2023-12-14 at 09 37 02

@fecorreiabr
Copy link

@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
Copy link

Straboxer commented Jan 26, 2024

@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
Copy link
Collaborator

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

@Straboxer
Copy link

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

@DonJayamanne
Copy link
Collaborator

DonJayamanne commented Jan 30, 2024

  • Please can you enable debug logging using the following setting,
    Screenshot 2024-01-30 at 11 24 26
  • Download the following zip file and extract it.
  • Install the above vsix using the command Install from VSIX
  • When prompted, please reload VS Code
  • Test again and please share the logs from the JupyterHub output channel
    • Use the command Outputs: Show Output Channels and select JupyterHub

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

@cchen777
Copy link

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

  • jupyter.allowUnauthorizedRemoteConnection: true
  • set Jupyterhub Log level to debug
    i'm suspecting this is because there's an auth redirect when visit our company's Jupyterhub site but from the logging cannot see any useful information, do you have any suggestion on this? many thanks!
    image
    image

Environment data

  • VS Code Version: 1.86.2
  • jupyterhub vscode extension: v2023.10.1003492320 (pre-release)
  • jupyter vscode extension: v2024.1.2024012502 (pre-release)
  • jupyterhub: 3.1.1
  • jupyter-server: 1.24.0

@DonJayamanne
Copy link
Collaborator

Please open the dev tools using the command Toggle Developer Tools

  • Then look for errors in the console widow, if there are any, please paste them here
  • Also you might want to open the Network tab and try again, then all http* requests will be logged along with any errors.
    If there are any errors in the network tab as well, please paste them here

@cchen777
Copy link

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
Copy link
Collaborator

@cchen777

  • What version of Jupyter Hub is that
  • Can you try the url without the trailing ? character

@cchen777
Copy link

cchen777 commented Mar 20, 2024

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
Copy link

kaigg96 commented Mar 25, 2024

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
Copy link

lateo-net commented Apr 2, 2024

Same issue : "Invalid JupyterHub URL specified"

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

JupyterHub :

  • 4.0.2 20240401063551,
  • configured with Google OAuth
  • nginx reverse proxy
  • Valid (let's encrypt) SSL cert and DNS record ; browsers are happy with the setup.

URL in kernel selection :
https://jupyter.{domain.tld}/user/{[email protected]}/?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
Copy link
Collaborator

@lateo-net @cchen777 @snami100
Please could you

  • Download the attached file
  • Extract this file
  • Open VS Code and select the command Install from VSIX
  • Select the above extracted VSIX
  • When prompted to reload VS Code, please do so
  • Try to replicate the issue once again
    ms-toolsai-jupyter-hub-insiders.vsix.zip

@lateo-net
Copy link

@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
Copy link

kaigg96 commented Apr 5, 2024

@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
Copy link

kaigg96 commented Apr 10, 2024

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
Copy link

add env var NODE_TLS_REJECT_UNAUTHORIZED=0

Where to set this?command line?

@jamessong
Copy link

jamessong commented Apr 14, 2024

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
Copy link

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
Copy link

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
Copy link

hankniel commented Jun 6, 2024

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
Copy link

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
Copy link

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
Copy link

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
Copy link
Collaborator

Please can you

  • Uninstall JupyterHub extension
  • Download the attached file
  • Extract this file
  • Open VS Code and select the command Install from VSIX
  • Select the above extracted VSIX
  • Enable logging (debug logging)
  • When prompted to reload VS Code, please do so
  • Try to replicate the issue once again
  • Capture all the logs from the JupyterHub output panel
  • Share the logs

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
Copy link

PhenomenaPh commented Jul 30, 2024

@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:

  • {jupyter_url}/user/{user_name}/lab
  • [https://jupyter.{domain.tld}/user/{[email protected]}/?token={TokenCreatedFromJupyterHubControlPanel}]

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

image

@DonJayamanne
Copy link
Collaborator

DonJayamanne commented Jul 31, 2024

  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
Copy link

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
Copy link

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
Copy link

AsyqD commented Nov 20, 2024

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!

@XinSong
Copy link

XinSong commented Jan 22, 2025

I have the same problem, but the solution above doesn't work for me。My jupyterhub version is 1.0.0, and I don't have the right to upgrade it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

Successfully merging a pull request may close this issue.