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

Vague error message for install_gitlab - OpenSSL issue #762

Closed
reisner opened this issue Jun 15, 2023 · 3 comments
Closed

Vague error message for install_gitlab - OpenSSL issue #762

reisner opened this issue Jun 15, 2023 · 3 comments

Comments

@reisner
Copy link

reisner commented Jun 15, 2023

Hi there,

I've recently encountered an error when trying to run install_gitlab from a local gitlab repository. I encountered this error:

> remotes::install_gitlab(c('project/path'),host = 'host.url.here',auth_token ='my-gitlab-token', upgrade = 'never')
Error: Failed to install 'unknown package' from GitLab:
  cannot open URL 'https://host.url.here/api/v4/projects/project%2Fpath/repository/files/DESCRIPTION/raw?ref=HEAD'

When I click on the URL, it works fine, and the error message didnt give much more info. After a bunch of digging, I discovered that it was an SSL problem. I was able to figure out the details for this by trying to pull the package with curl:

# curl --header "PRIVATE-TOKEN: my-gitlab-token" "https://host.url.here/api/v4/projects/project%2Fpath/repository/files/DESCRIPTION/raw?ref=HEAD" --output tmp.txt
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (35) error:0A000152:SSL routines::unsafe legacy renegotiation disabled

The error unsafe legacy renegotiation disabled is the source of this problem, and has led me to this stack overflow answer, which made me realize this is likely a firewall issue.

Anyways, the issue is that the original error of "cannot open URL" was very vague and I had to figure out what the source of the error was. I think this error message could at least display the source error (i.e. the output from curl). This could potentially also help resolve some of the other issues on this package like this one, and this one.

@gaborcsardi
Copy link
Member

Unfortunately it seems that that's the error message remotes gets from utils::download.file(), and there isn't much it can do.

@reisner
Copy link
Author

reisner commented Jun 21, 2023

OK thanks for the info. I've tracked it down to this line in base_download_headers in R/download.R:

  suppressWarnings(
    utils::download.file(
      url,
      path,
      method = method,
      quiet = quiet,
      mode = "wb",
      headers = headers
    )
  )

When I run it like that, I get this output:

Error in utils::download.file(url, path, method = method, quiet = quiet,  : 
  cannot open URL 'https://host.url.here/api/v4/projects/project%2Fpath/repository/files/DESCRIPTION/raw?ref=HEAD'

However, when I dont use suppressWarnings, I see this:

Error in utils::download.file(url, path, method = method, quiet = quiet,  : 
  cannot open URL 'https://host.url.here/api/v4/projects/project%2Fpath/repository/files/DESCRIPTION/raw?ref=HEAD'
In addition: Warning message:
In utils::download.file(url, path, method = method, quiet = quiet,  :
  URL 'https://host.url.here/api/v4/projects/project%2Fpath/repository/files/DESCRIPTION/raw?ref=HEAD': status was 'SSL connect error'

Note the warning about the SSL connect error. Looks like utils::download.file can see that it's an SSL issue, but it's just exposing this as a warning, not an error. :(

Is there any way to raise this issue in the utils base library?

@reisner
Copy link
Author

reisner commented Jun 21, 2023

I guess the alternative is to remove the suppressMessages here? That would allow for more information to bubble up.

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

No branches or pull requests

2 participants