rshinyshinyapps

failed to match connection hostname (api.shinyapps.io) against server certificate names


when deploying a shiny app, rstudio ide shows the error:

Error in curl::curl_fetch_memory(url, handle = handle) : schannel: CertGetNameString() failed to match connection hostname (api.shinyapps.io) against server certificate names Calls: ... tryCatch -> tryCatchList -> tryCatchOne -> Timing stopped at: 0.02 0.02 0.8 Execution halted

this is for windows 7(64bit).

the details:

----- Deployment log started at  2019-08-03 01:42:06  -----
Deploy command: 
 rsconnect::deployApp(appDir = "D:/shinyTest/_app002",      appFileManifest = "C:/Users/ADMINI~1/AppData/Local/Temp/2013-805c-ca6a-04c2",      account = "r00", server = "shinyapps.io", appName = "_app002",      appTitle = "_app002", launch.browser = function(url) {         message("Deployment completed: ", url)     }, lint = FALSE, metadata = list(asMultiple = FALSE, asStatic = FALSE),      logLevel = "verbose") 

Session information: 
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936 
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936   
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C                                                   
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.6.1   rsconnect_0.8.15
Cookies: 
[1] "None"
----- Deployment error -----
Error in curl::curl_fetch_memory(url, handle = handle) : 
  schannel: CertGetNameString() failed to match connection hostname (api.shinyapps.io) against server certificate names
Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>

----- Error stack trace -----
20: stop(e)
19: value[[3L]](cond)
18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
17: tryCatchList(expr, classes, parentenv, handlers)
16: tryCatch({
        response <- curl::curl_fetch_memory(url, handle = handle)
    }, error = function(e, ...) {
        if (identical(e$message, "Callback aborted") || identical(e$message, 
            "transfer closed with outstanding read data remaining")) 
            return(NULL)
        else stop(e)
    })
15: system.time(gcFirst = FALSE, tryCatch({
        response <- curl::curl_fetch_memory(url, handle = handle)
    }, error = function(e, ...) {
        if (identical(e$message, "Callback aborted") || identical(e$message, 
            "transfer closed with outstanding read data remaining")) 
            return(NULL)
        else stop(e)
    }))
14: http(service$protocol, service$host, service$port, method, url, 
        headers, timeout = timeout, certificate = certificate)
13: httpInvokeRequest(..., http = httpFunction())
12: httpRequest(service, authInfo, "GET", path, query, headers, timeout)
11: GET(service, authInfo, path, queryWithList)
10: grepl(contentType, response$contentType, fixed = TRUE)
9: isContentType(response, "application/json")
8: handleResponse(GET(service, authInfo, path, queryWithList))
7: listRequest(service, authInfo, path, query, "applications")
6: client$listApplications(accountInfo$accountId, filters = list(name = name))
5: getAppByName(client, accountInfo, target$appName)
4: applicationForTarget(client, accountDetails, target, forceUpdate)
3: force(code)
2: withStatus(paste0("Preparing to deploy ", assetTypeName), {
       application <- applicationForTarget(client, accountDetails, 
           target, forceUpdate)
   })
1: rsconnect::deployApp(appDir = "D:/shinyTest/_app002", 
       appFileManifest = "C:/Users/ADMINI~1/AppData/Local/Temp/2013-805c-ca6a-04c2", 
       account = "r00", server = "shinyapps.io", appName = "_app002", 
       appTitle = "_app002", launch.browser = function(url) {
           message("Deployment completed: ", url)
       }, lint = FALSE, metadata = list(asMultiple = FALSE, asStatic = FALSE), 
       logLevel = "verbose")
Error in curl::curl_fetch_memory(url, handle = handle) : 
  schannel: CertGetNameString() failed to match connection hostname (api.shinyapps.io) against server certificate names
Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Timing stopped at: 0.02 0.02 0.8
Execution halted

can anyone help me? thx!


Solution

  • I had this issue just yesterday and saw the same error when trying to deploy an app. If you're like me, you searched and found that similar errors are observed if you have a proxy server in the way. With that being said, I am assuming that you are not behind a proxy server. If you are, follow some of what is said elsewhere.

    I am also assuming that you have previously setup your account via rsconnect::setAccountInfo(). If not, follow the instructions on the rsconnect documentation.

    If all that is set, note the text of the error specifies that the issue is actually an error in the curl package:

    Error in curl::curl_fetch_memory(url, handle = handle) : schannel: CertGetNameString() failed to match connection hostname (api.shinyapps.io) against server certificate names

    The simple answer would be to update specifically the curl package: install.packages('curl'). That worked for me... does that help?