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

GitHub re-login after refresh the page - vscode server #214110

Open
boltonidze opened this issue May 17, 2024 · 8 comments
Open

GitHub re-login after refresh the page - vscode server #214110

boltonidze opened this issue May 17, 2024 · 8 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@boltonidze
Copy link

Hello!

We deploy our VSCode in k8s with jupyterhub (instead of running jupyterlab we run vscode pod for each user). Pod with vscode lives endless. Everything work fine, but after refresh the page GitHub pull request plugin ask to login again.

I try to understand is it possible to avoid login to GitHub after each page refresh?

  • Extension version: v0.88.1
  • VSCode Version: 1.89.1

In logs I see

2024-05-17 17:33:22.309 [info] Reading sessions from keychain...
2024-05-17 17:33:22.309 [info] Getting sessions for all scopes...
2024-05-17 17:33:22.309 [info] Got 0 sessions for ...
2024-05-17 17:33:22.309 [info] Getting sessions for all scopes...
2024-05-17 17:33:22.309 [info] Got 0 sessions for ...
2024-05-17 17:33:25.669 [info] Getting sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:33:25.670 [info] Got 0 sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:33:25.673 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:25.673 [info] Got 0 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:26.212 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:26.213 [info] Got 0 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:26.369 [info] Getting sessions for read:user,repo,user:email...
2024-05-17 17:33:26.369 [info] Got 0 sessions for read:user,repo,user:email...
2024-05-17 17:33:26.500 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:26.500 [info] Got 0 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:26.847 [info] Getting sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:33:26.847 [info] Got 0 sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:33:26.997 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:26.997 [info] Got 0 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:27.171 [info] Getting sessions for read:user,repo,user:email...
2024-05-17 17:33:27.171 [info] Got 0 sessions for read:user,repo,user:email...
2024-05-17 17:33:27.337 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:27.338 [info] Got 0 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:28.832 [info] Getting sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:33:28.832 [info] Got 0 sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:33:28.963 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:28.963 [info] Got 0 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:29.103 [info] Getting sessions for read:user,repo,user:email...
2024-05-17 17:33:29.103 [info] Got 0 sessions for read:user,repo,user:email...
2024-05-17 17:33:29.246 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:29.246 [info] Got 0 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:30.440 [info] Logging in for the following scopes: read:user repo user:email workflow
2024-05-17 17:33:30.566 [info] Trying device code flow... (read:user repo user:email workflow)
2024-05-17 17:33:58.039 [info] Getting user info...
2024-05-17 17:33:58.294 [info] Got account info!
2024-05-17 17:33:58.295 [info] Storing 1 sessions...
2024-05-17 17:33:58.348 [info] Reading sessions from keychain...
2024-05-17 17:33:58.348 [info] Stored 1 sessions!
2024-05-17 17:33:58.351 [info] Login success!
2024-05-17 17:33:58.457 [trace] Token acquired from secret storage.
2024-05-17 17:33:58.457 [info] Got stored sessions!
2024-05-17 17:33:58.457 [trace] Read the following session from the keychain with the following scopes: read:user repo user:email workflow
2024-05-17 17:33:58.458 [info] Got 1 verified sessions.
2024-05-17 17:33:58.686 [info] Getting sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:33:58.687 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:58.687 [info] Got 0 sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:33:58.687 [info] Got 1 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:58.903 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:58.903 [info] Got 1 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:59.547 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:33:59.547 [info] Got 1 sessions for read:user,repo,user:email,workflow...

But after refresh a page token is missing again:

2024-05-17 17:36:01.475 [info] Reading sessions from keychain...
2024-05-17 17:36:01.475 [info] Getting sessions for all scopes...
2024-05-17 17:36:01.475 [info] Got 0 sessions for ...
2024-05-17 17:36:01.475 [info] Getting sessions for all scopes...
2024-05-17 17:36:01.475 [info] Got 0 sessions for ...
2024-05-17 17:36:04.516 [info] Getting sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:36:04.516 [info] Got 0 sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:36:04.548 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:36:04.549 [info] Got 0 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:36:04.946 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:36:04.946 [info] Got 0 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:36:05.116 [info] Getting sessions for read:user,repo,user:email...
2024-05-17 17:36:05.116 [info] Got 0 sessions for read:user,repo,user:email...
2024-05-17 17:36:05.393 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:36:05.393 [info] Got 0 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:36:05.754 [info] Getting sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:36:05.755 [info] Got 0 sessions for project,read:org,read:user,repo,user:email,workflow...
2024-05-17 17:36:05.897 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:36:05.897 [info] Got 0 sessions for read:user,repo,user:email,workflow...
2024-05-17 17:36:06.044 [info] Getting sessions for read:user,repo,user:email...
2024-05-17 17:36:06.044 [info] Got 0 sessions for read:user,repo,user:email...
2024-05-17 17:36:06.200 [info] Getting sessions for read:user,repo,user:email,workflow...
2024-05-17 17:36:06.200 [info] Got 0 sessions for read:user,repo,user:email,workflow...
@alexr00
Copy link
Member

alexr00 commented May 27, 2024

@boltonidze are you using VS Code in your browser?

@alexr00 alexr00 added the info-needed Issue requires more information from poster label May 27, 2024
@boltonidze
Copy link
Author

Yes, that's true. We are deploying it to k8s with Juperyhub. After this the flow is the same as for Jupyterhub - users can open a bowser and run their own servers (pods) with VSCode. The problem is that we have GitHub Pull Request plugin, but when users refresh the page in his browser, they have to re-login to GitHub again.

@alexr00
Copy link
Member

alexr00 commented May 27, 2024

@TylerLeonhardt do you know why this might happen?

@TylerLeonhardt TylerLeonhardt transferred this issue from microsoft/vscode-pull-request-github Jun 3, 2024
@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Jun 3, 2024

@boltonidze when the user refreshes their page, are they re-connecting to the same container instance or is a fresh container instance?

Also, can you share how you're deploying VS Code and where you are getting it from so we're sure you're using a supported thing?

Also, can you share the server logs? As in, the logs where you are executing the VS Code CLI.

@TylerLeonhardt TylerLeonhardt self-assigned this Jun 3, 2024
@TylerLeonhardt TylerLeonhardt changed the title GitHub re-login after refresh the page GitHub re-login after refresh the page - vscode server Jun 3, 2024
@boltonidze
Copy link
Author

@TylerLeonhardt Users re-connect to the same container (pod), we don't kill it.

Server last logs are below:

[02:06:08] [192.168.200.27][b4da9d4c][ExtensionHostConnection] The client has reconnected.
[02:06:08] [192.168.200.27][ec28d682][ManagementConnection] The client has reconnected.
[02:06:08] [192.168.200.27][1d3bdfcd][ExtensionHostConnection] The client has reconnected.
[02:06:08] [192.168.200.27][88101802][ManagementConnection] The client has reconnected.
[02:22:31] Error: read ETIMEDOUT
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -110,
  code: 'ETIMEDOUT',
  syscall: 'read'
}
[02:22:31] [192.168.200.27][ec28d682][ManagementConnection] The client has disconnected, will wait for reconnection 3h before disposing...
[02:22:39] Error: read ETIMEDOUT
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -110,
  code: 'ETIMEDOUT',
  syscall: 'read'
}
[02:22:39] [192.168.200.27][88101802][ManagementConnection] The client has disconnected, will wait for reconnection 3h before disposing...
[05:22:38] [192.168.200.27][ec28d682][ManagementConnection] The reconnection grace time of 3h has expired, so the connection will be disposed.
[05:22:41] [192.168.200.27][b4da9d4c][ExtensionHostConnection] <132127> Extension Host Process exited with code: 0, signal: null.
[05:22:43] [192.168.200.27][1d3bdfcd][ExtensionHostConnection] <132138> Extension Host Process exited with code: 0, signal: null.
[05:22:46] [192.168.200.27][88101802][ManagementConnection] The reconnection grace time of 3h has expired, so the connection will be disposed.
[08:05:56] [192.168.200.27][b4da9d4c][ExtensionHostConnection] Unknown reconnection token (seen before).
[08:05:56] [192.168.200.27][1d3bdfcd][ExtensionHostConnection] Unknown reconnection token (seen before).
[08:06:47] [192.168.200.27][ec28d682][ManagementConnection] Unknown reconnection token (seen before).
[08:06:48] [192.168.200.27][88101802][ManagementConnection] Unknown reconnection token (seen before).
[18:30:13] [192.168.200.27][d34b831c][ManagementConnection] New connection established.
[18:30:13] [192.168.200.27][2b1651d7][ExtensionHostConnection] New connection established.
[18:30:13] [192.168.200.27][2b1651d7][ExtensionHostConnection] <185200> Launched Extension Host Process.
[18:32:05] [192.168.200.27][d34b831c][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[18:32:05] [192.168.200.27][2b1651d7][ExtensionHostConnection] <185200> Extension Host Process exited with code: 0, signal: null.
[18:32:06] [192.168.200.27][06a52610][ManagementConnection] New connection established.
[18:32:06] [192.168.200.27][a7d64611][ExtensionHostConnection] New connection established.
[18:32:06] [192.168.200.27][a7d64611][ExtensionHostConnection] <185421> Launched Extension Host Process.


I opened VSCode at 18:30:13 after long-time of inactivity and logged into GitHub for GitHub Pull Request Plugin. After that I refreshed the page at 18:32:05 and GitHub Pull Request Plugin started asking for login again.

@TylerLeonhardt
Copy link
Member

Also, can you share how you're deploying VS Code and where you are getting it from so we're sure you're using a supported thing?

Can you answer this one too? How are you deploying and what are you running exactly to start the server.

@boltonidze
Copy link
Author

@TylerLeonhardt Yes, sure.

We deployed with jupyter-hub helm chart. But we patched the original jupyterhub/k8s-hub:1.2.0 image to redirect to IP-address of pod instead of /user/<username>.

We patched it because Configurable http proxy (this is a component of jupyter-hub that proxy different HTTP-connection to different machines depending on the prefix path of input request) changes path in requests from /user/<username>/<something> -> /<something>, but CHP can't change body of HTML-files which can contains something like this

<script async="" src="/user/<_username_>/lab/extensions/catboost-widget/static/remoteEntry.ebd57709384ca584b1c0.js"></script>

The rest of the deployment is the same as for jupyterhub. We use "https://aka.ms/install-vscode-server/setup.sh" script to install vscode inside the contauner. When VSCode server starts, we use the following script to install extensions:

set -eo pipefail
set +x
echo `pwd`
whoami
ls -la

if ! [ -d installed_plugins ]; then
  mkdir installed_plugins
fi

if ! [ -f installed_plugins/dbt_ext ]; then
  code-server serve-local --install-extension innoverio.vscode-dbt-power-user --verbose --accept-server-license-terms >> installed_plugins/dbt_ext
fi

if ! [ -f installed_plugins/sqlfluff_ext ]; then
  code-server serve-local --install-extension dorzey.vscode-sqlfluff --verbose --accept-server-license-terms >> installed_plugins/sqlfluff_ext
fi

if ! [ -f installed_plugins/github_ext ]; then
  code-server serve-local --install-extension GitHub.vscode-pull-request-github --verbose --accept-server-license-terms >> installed_plugins/github_ext
fi

and the server itself starts with:

/usr/local/bin/code-server serve-local --accept-server-license-terms --without-connection-token --host 0.0.0.0 --verbose --port 8888

@TylerLeonhardt
Copy link
Member

Hi @boltonidze 👋 that code-server is really old. Now we have this built-in to the code CLI itself:

https://code.visualstudio.com/blogs/2022/12/07/remote-even-better#_enhanced-code-cli

We should have a working scenario where your secrets are stored properly in the browser so that login persists so please give that a try and let us know how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants