Error in deploying shiny app

I am having issues deploying my app to shinyapps.io.

When I deploy it, it starts up alright, then it comes up with this error:

Preparing to deploy application...DONE
Uploading bundle for application: 1535708...DONE
Deploying bundle: 2729500 for application: 1535708 ...
Waiting for task: 683067389
  building: Parsing manifest
  building: Building image: 2983839
  building: Installing system dependencies
  building: Fetching packages
  building: Installing packages
  building: Installing files
Error in curl::curl_fetch_memory(url, handle = handle) : 
  schannel: next InitializeSecurityContext failed: SEC_E_DECRYPT_FAILURE (0x80090330) - The specified data could not be decrypted.
Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Timing stopped at: 0 0 1.04
Execution halted

Any ideas on how to fix this? It runs fine on my desktop.

Additional note: I have noticed that the app does actually deploy to shinyapps.io (with changes) despite the error. Still though, it would be good to work out what the issue is. Thanks.

What version of the rsconnect package are you using?
What is your local operating system?
Do you have any proxies or firewalls between you and the internet?

Hi Josh,

I was running rsconnect version 0.8.15 but have now upgraded to 0.8.16.

I am running Windows 10. I am at work so I assume that there are lots of firewalls.

However, it has uploaded in the past without any issues. Or at other times, there would be an error, (a different one, but I don't remember what it was), but then it would work a couple of hours later.

Anyway, this is the latest message:

Preparing to deploy application...DONE
Uploading bundle for application: 1535708...DONE
Deploying bundle: 2731992 for application: 1535708 ...
Waiting for task: 683331525
  building: Parsing manifest
  building: Building image: 2987273
  building: Installing system dependencies
  building: Fetching packages
  building: Installing packages
  building: Installing files
  building: Pushing image: 2987273
Error in curl::curl_fetch_memory(url, handle = handle) : 
  schannel: next InitializeSecurityContext failed: SEC_E_DECRYPT_FAILURE (0x80090330) - The specified data could not be decrypted.
Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Timing stopped at: 0 0 1.01
Execution halted

Let me try to loop in one of the developers of the rsconnect package to this topic.

Meantime, could you re-run with the options rsconnect.http.verbose and rsconnect.http.trace set to TRUE and post the output?

Hi Josh,

I reran it with these:

options(rsconnect.http.trace = TRUE)
options(rsconnect.http.verbose = TRUE)

I got this error (the code is different):

Preparing to deploy application...DONE
Uploading bundle for application: 1535708...DONE
Deploying bundle: 2739988 for application: 1535708 ...
Waiting for task: 684236297
  building: Parsing manifest
  building: Building image: 2997594
  building: Installing system dependencies
  building: Installing packages
  building: Installing files
  building: Pushing image: 2997594
Error in curl::curl_fetch_memory(url, handle = handle) : 
  schannel: next InitializeSecurityContext failed: SEC_E_INVALID_TOKEN (0x80090308) - The token supplied to the function is invalid
Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Timing stopped at: 0 0 1.3
Execution halted

It says there is a token issue, but I haven't changed it since last time.

I have to say I am surprised that there was not any debugging output.

@jonathan do you have any thoughts?

Hi @josh and @jonathan, have you had a chance to look in to this?

I haven't changed anything, but I have a different error today:

Preparing to deploy application...DONE
Uploading bundle for application: 1535708...DONE
Deploying bundle: 2759400 for application: 1535708 ...
Waiting for task: 686767954
  building: Processing bundle: 2759400
  building: Parsing manifest
  building: Building image: 3027131
  building: Installing system dependencies
  building: Fetching packages
  building: Installing packages
Error in curl::curl_fetch_memory(url, handle = handle) : 
  schannel: next InitializeSecurityContext failed: Unknown error (0x80096004) - The signature of the certificate cannot be verified.
Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Timing stopped at: 0 0 1.72
Execution halted

If you are using push-button deployment, your next step should be to try enabling publishing diagnostics in RStudio. In Options -> Publishing, check "Show Diagnostic Information".

You might also try updating the curl R package (this sounds like it could be related to OpenSSL versions).

Thanks. I have just updated curl from 3.3 to 4.3.

I have also turned on the diagnostic information.

This is the output when I try to publish it:

----- Deployment log started at  2020-01-31 09:00:21  -----
Deploy command: 
 rsconnect::deployApp(appDir = "C:/Users/WilliamLa/Desktop/MV2040 outcomes framework",      appFileManifest = "C:/Users/WILLIA~1/AppData/Local/Temp/4ac4-ea4a-e0bf-8182",      account = "williaml", server = "shinyapps.io", appName = "mv2040_outcomes_framework",      appId = 1535708, 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 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

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.16
Cookies: 
[1] "None"
GET /v1/applications/1535708 2590ms
----- Bundle upload started at  2020-01-31 09:00:23  -----
[2020-01-31 09:00:23] Inferring App mode and parameters 
[2020-01-31 09:00:23] Bundling app dir 
[2020-01-31 09:00:23] Generate manifest.json 
[2020-01-31 09:01:37] Writing Rmd index if necessary 
[2020-01-31 09:01:37] Compressing the bundle 
POST /v1/bundles 2429ms
[2020-01-31 09:01:39] Starting upload now 
PUT /bundles/application-1535708/cb0326e1333d47f890cecc461e864494.tar.gz?AWSAccessKeyId=ASIA54P7SCTKVW7XO2XW&x-amz-acl=bucket-owner-full-control&Expires=1580425299&content-md5=VXvqAwGXiPEAj9%2FtAp8bxQ%3D%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEFwaCXVzLWVhc3QtMSJIMEYCIQCWjG%2BTB1JcJBnCGo8p%2F1hUGx5qoLTrA68CSjsp%2FoeVdAIhANs8Slmc%2Faw4rlloOYf6Fg1QEcvnMmMi%2Flc%2FZ%2BpllCR3Kr0DCPX%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQABoMOTU0NTU1NTY5MzY1IgyqkZu7AeMxsqz%2F5EMqkQPcMzF2lcaLajgw5xbSf%2FUl8qCMsEswz3RfX2HYwwDQqq5Ajw0woGd75r4GEJ5oG73lR6EQ393AtqgQeuuFPAdx7ZycnAv1XCPc35eQBu2e6ZFXh%2FW%2BKMFFb%2BVj6eKeYPMUIhhCRtB6s7INC0BVhxti8c1mhrgffXPKXKPqGCluUsnyIVKS1hUX6aeM%2FUYrDAPCByLJvVHFj2cN%2BZd4isINUkD%2FngIpmYGl4OCIVFRGc7hsvdYOp7Nl5nHiY%2BxlHIKtrXrnQWRsurBIypWslreeaN0fHOrbe%2Bpdakjk%2FjdQiyYEf1CC%2BDXdErg%2B4jX0Ynbs1EQOXmJznPQggv665mwC9p7FVCLc%2BK5s7TVQl6od5CKpFJOVaZ1Lfp9mnDs1i1wAs%2Fiu%2Bk4LqPMjdtLbsCE4q6d3FqXsqMdbaB7Jaqy1OQWbc2xdy1u7Eq34wwtcbhh6cUlCi0pB0QtaAyI%2BfAirFDY1Ox9m0OpxXkPQs46vWOtWwQ3QkIkiqO8g6O%2B7Cm3I9BQwuvx26FbJTnqhAtR6ITD%2F7MzxBTrqAVqyIDVbMFS6Cv9%2F5nF3kxFIKCYzPvLrVrhZKXlLNV8Zv7RiSSDecvLbtEPjH1E7Y3RFprS%2B%2BIaKd1nEl6bVwaUyk%2BI2Ce47091XF2%2Bv7BkYDvbMtqHvgmS%2FIsdBwz%2BcM6TTKwRq3caV0HtQoRdw4O3SX9QJKzcOIjH2EWIBk01B2N4sMjJk1b%2BKrB4q%2BW3Zks4pPxWVO%2BypHAe0RJwaUZy4AOP5wcmgCCo0c6FdWomiyQJWDM0SB7DemUj7%2Fq6P63WeIEXc0DOKu%2BN7jsT%2BL7367Tl7laaYYx7rfvqQTtk8tING7eKDiq6owA%3D%3D&Signature=0Yh4CRIG%2FT7hCyizidTAJBntH%2B0%3D&content-type=application%2Fx-tar 3430ms
[2020-01-31 09:01:43] Upload complete 
POST /v1/bundles/2765033/status 1300ms
GET /v1/bundles/2765033 2319ms
[2020-01-31 09:01:46] Saving deployment record for mv2040_outcomes_framework -  
----- Server deployment started at  2020-01-31 09:01:46  -----
POST /v1/applications/1535708/deploy 1379ms
Waiting for task: 687469728
GET /v1/tasks/687469728 1250ms
  building: Parsing manifest
GET /v1/tasks/687469728 1250ms
  building: Building image: 3037365
GET /v1/tasks/687469728 1329ms
  building: Installing system dependencies
GET /v1/tasks/687469728 1900ms
GET /v1/tasks/687469728 1329ms
----- Deployment error -----
Error in curl::curl_fetch_memory(url, handle = handle) : 
  schannel: next InitializeSecurityContext failed: SEC_E_INVALID_TOKEN (0x80090308) - The token supplied to the function is invalid
Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
 
----- Error stack trace -----
15: stop(e)
14: value[[3L]](cond)
13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
12: tryCatchList(expr, classes, parentenv, handlers)
11: 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)
    })
10: 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)
    }))
9: http(service$protocol, service$host, service$port, method, url, 
       headers, timeout = timeout, certificate = certificate)
8: httpInvokeRequest(..., http = httpFunction())
7: httpRequest(service, authInfo, "GET", path, query, headers, timeout)
6: GET(service, authInfo, path)
5: grepl(contentType, response$contentType, fixed = TRUE)
4: isContentType(response, "application/json")
3: handleResponse(GET(service, authInfo, path))
2: client$waitForTask(taskId, quiet)
1: rsconnect::deployApp(appDir = "C:/Users/WilliamLa/Desktop/MV2040 outcomes framework", 
       appFileManifest = "C:/Users/WILLIA~1/AppData/Local/Temp/4ac4-ea4a-e0bf-8182", 
       account = "williaml", server = "shinyapps.io", appName = "mv2040_outcomes_framework", 
       appId = 1535708, 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: next InitializeSecurityContext failed: SEC_E_INVALID_TOKEN (0x80090308) - The token supplied to the function is invalid
Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Timing stopped at: 0 0 1.02
Execution halted

By the way, sometimes it does actually update the app on shinyapps. I just made a change. The first time I tried to update it, it didn't update. The second time it did. I had the error messages both times.