rstudio / pins-r

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

Improve feedback when `key` supplied but blank #564

Closed akgold closed 2 years ago

akgold commented 3 years ago

This error is unhelpful.

> pins::board_rsconnect(server = 'https://colorado.rstudio.com/rsc', key = Sys.getenv("CONNECT_API_KEY"))
Connecting to RSC ??? at <https://colorado.rstudio.com/rsc>
Error: RStudio Connect API failed [401]
* We couldn't log you in with the provided credentials. Please ask your administrator for assistance.
Run `rlang::last_error()` to see where the error occurred.
> Sys.getenv("CONNECT_API_KEY")
[1] ""
hadley commented 2 years ago

Why are you getting the key like that? i.e. it's simpler to do this and you get a better error:

pins::board_rsconnect("envvar", server = 'https://colorado.rstudio.com/rsc')
akgold commented 2 years ago

This was a simplified reprex. I have multiple RSCs I'm connected to, so I had old code that used Sys.getenv("COLORADO_CONNECT_API_KEY"). I don't think that will be automatically picked up, right?

hadley commented 2 years ago

Ok, make sense. I think it's better to tackle this problem by treating "" and NULL the same way. I'll fix momentarily.

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.