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

rsconnect problems with port 443 and subpaths #364

Closed
colearendt opened this issue Feb 12, 2021 · 5 comments · Fixed by #426
Closed

rsconnect problems with port 443 and subpaths #364

colearendt opened this issue Feb 12, 2021 · 5 comments · Fixed by #426

Comments

@colearendt
Copy link
Contributor

There are a handful of related URL parsing problems:

  • mismatches on port :443 existing / not existing
  • subpaths (i.e. /rsconnect/) not being used, and server being used instead of url (from the rsconnect package)
  • token auth issues when port :443 is defined on the client, but not in the server
  • token auth / signature issues (if port mismatch between client and server)
  • port plus a path causing hard-to-debug issues with path creation
@colearendt colearendt changed the title Problems with port 443 and subpaths rsconnect problems with port 443 and subpaths Feb 12, 2021
@colearendt
Copy link
Contributor Author

colearendt commented Feb 12, 2021

Ultimately there is a bunch of confusing look-up behavior that muddies the waters of:

  • the "base URL" of the RStudio Connect server
  • the "server name" as provided to rsconnect (which is an arbitrary string that users can define, with default conventions that pins seems to depend upon)

For instance:

  • If "server name" in rsconnect is not a hostname (cole for this example), you have to use board_register_rsconnect(server = "cole"), and board_register_rsconnect(server = "https://colorado.rstudio.com/rsc/") will fail
  • If 'server name" in rsconnect "looks like" a hostname (i.e. colorado.rstudio.com for this example), you have to use a fully qualified URL. board_register_rsconnect(server = "colorado.rstudio.com") will fail, but board_register_rsconnect(server = "https://colorado.rstudio.com/rsc/") will succeed
  • Some places (where the server knows itself as https://colorado.rstudio.com:443/rsc) simply will not work because port mismatches with the "server name" (colorado.rstudio.com) creates a broken edge case
  • The token signature failure (also related to :443) is in here somewhere as well

Basically, I propose the following solution:

  • Key "only" on Base URLs for all behavior
  • If a "server name" is provided, replace it with a URL ASAP, and then key only on URLs. Guessing that "server name" can be treated like a hostname is an unsafe dependency on rsconnect defaults

The current state is untenable because server has to be different "types" of values in different cases, is very challenging to reason about, and in some cases, does not work at all (with very confusing error states).

Untangling all of the server name behavior will be tricky, especially with respect to backwards compatibility

@hlynurhallgrims
Copy link

Our data engineer had some input. There isn't actually a reference to port 443 in our config (see pic below). Rather, he believes that this might have to do with us running the nginx reverse proxy within a docker container, rather than as a general service. Just adding that for posterity.

image

@colearendt
Copy link
Contributor Author

colearendt commented Feb 19, 2021

@hlynurhallgrims thanks so much! That will be helpful information on reproducing with an integration test!

#366 has a proposed fix for the port behavior. Would you mind giving that a shot? I believe you can install with:

remotes::install_github("colearendt/pins@fix-urls")

To be clear, I have not done a full integration test yet, so there may be something else broken. But the one issue we nailed down should be solved / tested for, at least!

@hlynurhallgrims
Copy link

It's working like a charm for me! Thank you so much Cole! 🥳 🎉

#remotes::install_github("colearendt/pins@fix-urls", force = TRUE)
library(pins)

board_register("rsconnect", server = "https://rstudio-prod.northeurope.cloudapp.azure.com/connect")

pin(mtcars, name = "mtcars", board = "rsconnect")
pin_get("hlynur.hallgrimsson/mtcars", board = "rsconnect")
#> # A tibble: 32 x 11
#>      mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb
#>    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1  21       6  160    110  3.9   2.62  16.5     0     1     4     4
#>  2  21       6  160    110  3.9   2.88  17.0     0     1     4     4
#>  3  22.8     4  108     93  3.85  2.32  18.6     1     1     4     1
#>  4  21.4     6  258    110  3.08  3.22  19.4     1     0     3     1
#>  5  18.7     8  360    175  3.15  3.44  17.0     0     0     3     2
#>  6  18.1     6  225    105  2.76  3.46  20.2     1     0     3     1
#>  7  14.3     8  360    245  3.21  3.57  15.8     0     0     3     4
#>  8  24.4     4  147.    62  3.69  3.19  20       1     0     4     2
#>  9  22.8     4  141.    95  3.92  3.15  22.9     1     0     4     2
#> 10  19.2     6  168.   123  3.92  3.44  18.3     1     0     4     4
#> # … with 22 more rows

Created on 2021-02-20 by the reprex package (v0.3.0)

@hadley hadley mentioned this issue Apr 19, 2021
@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants