rstudio / pins-r

Pin, discover, and share resources
https://pins.rstudio.com
Other
312 stars 63 forks source link

Trying to pin on an old version of RSC yields unhelpful errors #465

Closed akgold closed 3 years ago

akgold commented 3 years ago

Newer versions of RSC (>= 1.8.8) make CONNECT_SERVER and CONNECT_API_KEY automatically available in the environment.

When a document that includes board_rsconnect() is deployed to an earlier version of RSC, the result is that the board_rsconnect() attempts to use rsconnect auth and it yields an error that the rsconnect package isn't found, probably sending people down a weird rabbithole.

It would be really helpful if board_rsconnect could detect if it were on RSC (R_CONFIG_ACTIVE env var is set automatically) and then force envvar auth, perhaps throwing a helpful error if the env vars aren't detected.

Maybe something like: "RStudio Connect 1.8.8 and newer automatically provide the environment variables CONNECT_SERVER and CONNECT_API_KEY. Upgrade or provide those variables manually in the environment variables pane."

hadley commented 3 years ago

Nice idea — can you please point me to docs for R_CONFIG_ACTIVE just so I can track in a comment?

hadley commented 3 years ago

Actually, I think I'll just make "auto" a bit smarter, and give a more informative error if it fails:

#> Error: auth = `auto` has failed to find way to authenticate
#> * Can't find CONNECT_SERVER and CONNECT_API_KEY envvars for `auth = 'envvar'`
#> * Can't find any rsconnect::accounts() for `auth = 'rsconnect'`
github-actions[bot] commented 2 years ago

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.