Skip to content

Conversation

@jcheng5
Copy link
Collaborator

@jcheng5 jcheng5 commented Mar 1, 2024

This PR makes Shiny detect that it's running on Codespaces, where the browser can't just point to http://127.0.0.1:{autoreload-port} and expect to succeed. Instead, a proxy URL is used. See Forwarding ports in your codespace.

Note that this alone is not enough to make autoreload work quite right on codespaces. The Shiny app will try to connect to the autoreload websocket server and fail. This is because Codespace's forwarded ports are private by default, and need you to access each proxy hostname via HTTP document load first so it can set some cookies and whatnot. A forthcoming PR for pyshiny-vscode will try to address this.

Update: Here's the corresponding pyshiny-vscode PR posit-dev/shiny-vscode#27

Trying to get past GitHub Codespaces giving a 404 between 10-20% of the time
when hitting the Run Shiny App button
Turns out devcontainers don't let you do this anyway. You can't use devcontainer.json to make ports public.
@jcheng5 jcheng5 marked this pull request as ready for review March 2, 2024 00:34
@jcheng5 jcheng5 requested a review from wch March 2, 2024 00:34
@wch wch added this to the v0.8.0 milestone Mar 2, 2024
# correctly proxy through this request, but give a 404 when the redirect is
# followed and app_url is requested. With the sleep, both requests tend to
# succeed reliably.
await asyncio.sleep(1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to check: it doesn't take this code path when developing locally, right?

@wch wch merged commit d612e1b into main Mar 4, 2024
@wch wch deleted the codespaces-autoreload branch March 4, 2024 16:06
schloerke added a commit that referenced this pull request Mar 6, 2024
* main: (35 commits)
  test: Speed up tests by using single page. Do not attempt deploys job unless conditions are valid (#1197)
  ci: Run `playwright-examples` on Python 3.12 as well (#1195)
  Shiny preset style updates and nudges (#1176)
  tests: Upload trace on failed tests (#1196)
  Fix datetime input in airmass example app (#1194)
  Better docs for `render.download` (#1193)
  Render `shiny.min.css` using `bs_theme()` (#1191)
  Fix `express.ui.update_date` and`express.ui.update_text` links (#1192)
  Use `cast()` for asgiref types only when type checking (#1190)
  Remove uvicorn and click dependencies in Emscripten (#1187)
  Remove asgiref run-time dependency (#1183)
  Install dev-shinylive via Makefile (#1184)
  Put all "Other Changes" items into one section
  Use consistent formatting for items in changelog
  Don't run playwright-deploys tests on release
  tests(resolve-id): Update window size to ensure tooltip is visible (#1179)
  Setup dev version 0.8.0.9000 (#1181)
  Bump version to 0.8.0
  Revert API changes made in `Selected rows method` #1121 (#1174)
  Make autoreload work on codespaces (#1167)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants