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

Remote SSH: HTML widget in R doesn't work #6015

Open
ZhimingYe opened this issue Jan 16, 2025 · 4 comments
Open

Remote SSH: HTML widget in R doesn't work #6015

ZhimingYe opened this issue Jan 16, 2025 · 4 comments

Comments

@ZhimingYe
Copy link

System details:

Positron and OS details:

Positron Version: 2025.01.0 (Universal) build 159
Code - OSS Version: 1.95.0
Commit: bc8820b
Date: 2025-01-09T23:29:00.471Z
Electron: 32.2.1
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Darwin arm64 24.0.0

Interpreter details:

R 4.3.1 in Ubuntu 22.04

Describe the issue:

May be a duplicated issue ( I have searched but not sure). HTML widget in R can not show in remote SSH sessions. It works well in local.

Steps to reproduce the issue:

In remote SSH:

# from https://gt.rstudio.com/articles/case-study-gtcars.html
library(tidyverse)
library(gt)
gtcars_8 <-
  gtcars |>
  group_by(ctry_origin) |>
  slice_head(n = 2) |>
  ungroup() |>
  filter(ctry_origin != "United Kingdom")
gtcars_8 |>
  group_by(ctry_origin) |>
  gt()

Expected or desired behavior:

Showing HTML widget output in Viewer.

Were there any error messages in the UI, Output panel, or Developer Tools console?

No, but viewer can't show it.

Image
@jmcphers
Copy link
Collaborator

Thanks, I can reproduce this with GT.

Image

Interestingly enough the plumbing seems to be working correctly; you can see above that we're opening up a port to proxy the URL for the widget, and in fact if I use the "open in new window" gesture the browser can load the content just fine:

Image

I don't have any trouble with other HTML widgets, though; DT works fine.

Image

Are you seeing this with any packages other than GT?

@ZhimingYe
Copy link
Author

ZhimingYe commented Jan 16, 2025

Thanks @jmcphers ! That’s really strange! DT also isn’t working in my environment. Emm, might be related to firewall? , but everything in VSCode seems to be working fine... So it doesn't be like to.

In Positron:
Image

In VSCode:

Image
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.1 (2023-06-16)
 os       Ubuntu 22.04.3 LTS
 system   x86_64, linux-gnu
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Asia/Shanghai
 date     2025-01-17
 pandoc   NA

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 bslib         0.5.1   2023-08-11 [1] CRAN (R 4.3.1)
 cachem        1.0.8   2023-05-01 [1] CRAN (R 4.3.1)
 cli           3.6.1   2023-03-23 [1] CRAN (R 4.3.1)
 crosstalk     1.2.0   2021-11-04 [1] CRAN (R 4.3.1)
 digest        0.6.33  2023-07-07 [1] CRAN (R 4.3.1)
 DT          * 0.30    2023-10-05 [1] CRAN (R 4.3.1)
 fastmap       1.1.1   2023-02-24 [1] CRAN (R 4.3.1)
 htmltools     0.5.8.1 2024-04-04 [1] CRAN (R 4.3.1)
 htmlwidgets   1.6.2   2023-03-17 [1] CRAN (R 4.3.1)
 jquerylib     0.1.4   2021-04-26 [1] CRAN (R 4.3.1)
 jsonlite      1.8.7   2023-06-29 [1] CRAN (R 4.3.1)
 magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.3.1)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.3.1)
 rlang         1.1.1   2023-04-28 [1] CRAN (R 4.3.1)
 sass          0.4.7   2023-07-15 [1] CRAN (R 4.3.1)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.3.1)
 yaml          2.3.7   2023-01-23 [1] CRAN (R 4.3.1)

 [1] /home/yezhiming/R/x86_64-pc-linux-gnu-library/4.3
 [2] /usr/local/lib/R/site-library
 [3] /usr/lib/R/site-library
 [4] /usr/lib/R/library

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────

@jmcphers
Copy link
Collaborator

If you press this button:

Image

it should open a web browser. Does the widget appear in that browser?

@ZhimingYe
Copy link
Author

No, web browser can't show it. @jmcphers

Based on your comment, I do some further investigation. This might because the SSH extension occasionally fails to handle port forwarding for HTML widgets properly, which could potentially affect all components.

If I don't do anything, web browser can't show anything:

Image

If I manually add this port to port forwarding, the webpage will display.

Image

After manually configuring port forwarding, the display issue with DT was completely resolved.

Image

GT can also display in the right of Positron!

Image

However, it seems that in your testing environment, GT fails to display even when port forwarding is established. I don’t have any ideas about this difference...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants