microsoft/planetary-computer-hub

Accessing kernel from vscode does not work - certificate has expired

ste-goldstein opened this issue · 8 comments

Steps to reproduce:

  • Follow instructions as per Use VS Code
  • Try to run code on the interactive Jupyter interpreter
  • The following error will occur
Error 14:08:50: Error loading notebook controllers [FetchError: request to https://pccompute.westeurope.cloudapp.azure.com/compute/user/<USER>/api/kernels?<KERNEL_NUM> failed, reason: certificate has expired
	at ClientRequest.<anonymous> (/home/user/.vscode/extensions/ms-toolsai.jupyter-2021.11.1001550889/out/client/extension.js:16:343322)
	at ClientRequest.emit (events.js:327:22)
	at ClientRequest.EventEmitter.emit (domain.js:467:12)
	at TLSSocket.socketErrorListener (_http_client.js:469:9)
	at TLSSocket.emit (events.js:315:20)
	at TLSSocket.EventEmitter.emit (domain.js:467:12)
	at emitErrorNT (internal/streams/destroy.js:106:8)
	at emitErrorCloseNT (internal/streams/destroy.js:74:3)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)]

Error 14:08:50: DataScience Error [FetchError: request to https://pccompute.westeurope.cloudapp.azure.com/compute/user/<USER>/api/kernels?<KERNEL_NUM> failed, reason: certificate has expired
	at ClientRequest.<anonymous> (/home/user/.vscode/extensions/ms-toolsai.jupyter-2021.11.1001550889/out/client/extension.js:16:343322)
	at ClientRequest.emit (events.js:327:22)
	at ClientRequest.EventEmitter.emit (domain.js:467:12)
	at TLSSocket.socketErrorListener (_http_client.js:469:9)
	at TLSSocket.emit (events.js:315:20)
	at TLSSocket.EventEmitter.emit (domain.js:467:12)
	at emitErrorNT (internal/streams/destroy.js:106:8)
	at emitErrorCloseNT (internal/streams/destroy.js:74:3)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)]

Error 14:08:50: DataScience Error [FetchError: request to https://pccompute.westeurope.cloudapp.azure.com/compute/user/<USER>/api/kernels?<KERNEL_NUM> failed, reason: certificate has expired
	at ClientRequest.<anonymous> (/home/user/.vscode/extensions/ms-toolsai.jupyter-2021.11.1001550889/out/client/extension.js:16:343322)
	at ClientRequest.emit (events.js:327:22)
	at ClientRequest.EventEmitter.emit (domain.js:467:12)
	at TLSSocket.socketErrorListener (_http_client.js:469:9)
	at TLSSocket.emit (events.js:315:20)
	at TLSSocket.EventEmitter.emit (domain.js:467:12)
	at emitErrorNT (internal/streams/destroy.js:106:8)
	at emitErrorCloseNT (internal/streams/destroy.js:74:3)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)]

Error 14:08:50: Failed to find & set preferred controllers [FetchError: request to https://pccompute.westeurope.cloudapp.azure.com/compute/user/<USER>/api/kernels?<KERNEL_NUM> failed, reason: certificate has expired
	at ClientRequest.<anonymous> (/home/user/.vscode/extensions/ms-toolsai.jupyter-2021.11.1001550889/out/client/extension.js:16:343322)
	at ClientRequest.emit (events.js:327:22)
	at ClientRequest.EventEmitter.emit (domain.js:467:12)
	at TLSSocket.socketErrorListener (_http_client.js:469:9)
	at TLSSocket.emit (events.js:315:20)
	at TLSSocket.EventEmitter.emit (domain.js:467:12)
	at emitErrorNT (internal/streams/destroy.js:106:8)
	at emitErrorCloseNT (internal/streams/destroy.js:74:3)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)]

Thanks for opening this issue. Can you confirm that you start up a notebook server (maybe using the JupyterHub UI) before trying to connect from VS Code?

Hi Tom. Yeah, the notebook is running on the browser.
I can reproduce the issue in Linux and Windows, and with another Planetary account.
I was able to run a Python kernel in vscode from https://app.sandbox.dea.ga.gov.au
So I think it's unlikely the issue is local.

Strange. I just checked again and things worked for me. Just to double check, I was using notebooks from https://github.com/microsoft/PlanetaryComputerExamples. Can you maybe clone that repo and see if it works for you?

A couple other things I verifed:

  1. The site's cert isn't expired
  2. I have the exact same version of the jupyter extension as you

I cloned the repo, and set the remote server (shown in the bottom right corner). In this case the button to run the notebook cell is greyed out. Please let me know if you have any ideas on how to narrow this down.
Screenshot from 2022-01-05 10-04-52

Hmm, I'm pretty confused right now. I got things working with VSCode Insiders (https://code.visualstudio.com/insiders/) but only on our staging JupyterHub. I couldn't get things working with our production hub using VSCode or VSCode Insiders (and I couldn't get our staging hub to work with VSCode).

Unfortunately I don't really use the Jupyter Notebook extension, so I'm not sure how to get additional debugging output :/

I could make it connect to PC HUB with VSCode after enabling the following option in settings:
image

It was refusing the retrieve the kernels list due to certificate expiration...

Hope it helps!

Ah, thanks for finding that setting. I apparently have it checked, which might explain why things were working for me.

I'm unfortunately not sure why VSCode thinks we have an invalid certificate. The JuyterHub deployment has a certificate (and I thought handled the SSL termination). Perhaps we need to do something extra / different for the jupyter servers...

@cordmaur I had that box checked by the time I reported the issue.
But it seems to be working since my last VSCode update, in both Linux and Windows.
Apparently setting proxy support for extensions setting to off can help, according to microsoft/vscode-jupyter#8811