Skip to content

Improved error message for private *dependency* errors #295

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

Open
bestdan opened this issue Feb 14, 2019 · 1 comment
Open

Improved error message for private *dependency* errors #295

bestdan opened this issue Feb 14, 2019 · 1 comment
Labels
feature a feature request or enhancement github

Comments

@bestdan
Copy link

bestdan commented Feb 14, 2019

BLUF:
Could we improve the error message for installing dependencies to:

  1. note when the 404 error comes from a dependency, not the main repo
  2. suggest the user switches to the Sys.setenv("GITHUB_PAT" = ###) method for multiple private installs
  3. potentially pass the auth_token down to the private dependency repo call

Imagine your installing a package using remotes::install_github("foo", auth_token = "###"), and you get this error message:

Downloading GitHub repo foo
Error: HTTP error 404.
  Not Found

  Rate limit remaining: 50/60
  Rate limit reset at: 2019-02-14 15:39:37 UTC

You might spend a bit of time confused if:

  1. the foo repo is not private
  2. foo is private, but you supplied a valid auth token.

If foo has dependency bar, then it's actually bar which is 404'ing.

If a repo/package has a dependency which is a private repo, and you supply a github token as an argument to the install_github(auth_token), the auth_token is not passed to installing the dependencies. Traceback below.

Traceback()

traceback()
16: stop(github_error(res))
15: github_commit(username = remote$username, repo = remote$repo, 
        host = remote$host, ref = remote$ref, pat = remote$auth_token %||% 
            github_pat(), use_curl = use_curl)
14: remote_sha.github_remote(x)
13: remote_sha(x)
12: FUN(X[[i]], ...)
11: vapply(remote, function(x) remote_sha(x), character(1))
10: package_deps(deps, repos = repos, type = type)
9: nrow(cran_deps)
8: combine_deps(package_deps(deps, repos = repos, type = type), 
       remote_deps(pkg, ...))
7: dev_package_deps(pkgdir, repos = repos, dependencies = dependencies, 
       type = type, ...)
6: install_deps(pkgdir, dependencies = dependencies, quiet = quiet, 
       build = build, build_opts = build_opts, upgrade = upgrade, 
       repos = repos, type = type, ...)
5: install(source, dependencies = dependencies, upgrade = upgrade, 
       force = force, quiet = quiet, build = build, build_opts = build_opts, 
       repos = repos, type = type, ...)
4: FUN(X[[i]], ...)
3: vapply(remotes, install_remote, ..., FUN.VALUE = character(1))
2: install_remotes(remotes, auth_token = auth_token, host = host, 
       dependencies = dependencies, upgrade = upgrade, force = force, 
       quiet = quiet, build = build, build_opts = build_opts, repos = repos, 
       type = type, ...)
1: remotes::install_github("foo",  auth_token = token2, force = TRUE)
@bestdan
Copy link
Author

bestdan commented Feb 15, 2019

This existing PR might solve the issue: https://github.com/r-lib/remotes/pull/266/files

BUT it looks like it currently only applies to gitlab, not github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement github
Projects
None yet
Development

No branches or pull requests

2 participants