Problem copying token and secret into RStudio: Error in function (type, msg, asError = TRUE)

1,202 views
Skip to first unread message

Seth Green

unread,
Jan 5, 2015, 10:59:33 AM1/5/15
to shiny-...@googlegroups.com
Hello,
I am fairly new to shiny and I've been using it for some projects for a class I've been taking.  It has worked great for the past several months, but this morning I tried to deploy a new App and I am having a problem.

I go to the shinyapp.io and log in to my account and copy my token and secret to the clipboard.  However, when I paste them into RStudio, I get the following error:

`
Error in function (type, msg, asError = TRUE)  : 
  error setting certificate verify locations:
  CAfile: C:/Users/Seth/Documents/R/win-library/3.1/shinyapps/cert/cacert.pem
  CApath: 
Timing stopped at: 0.03 0 0.22 
`

I have never seen this before.  When I google around for it, I mostly find issues with MacBooks and firewalls and things that seem unrelated.  I can't seem to find any threads about these sorts of errors in shiny.

I'm sort of at a dead end for how to fix this.  Any help would be greatly appreciated.

I'm using:
Windows 7
RStudio Version 0.98.978 
R Version 3.1.1
I downloaded the most recent version of shiny with devtools and tried it again, but got the same error

Andy Kipp

unread,
Jan 5, 2015, 11:08:53 AM1/5/15
to Seth Green, shiny-discuss
Can you try reinstalling RCurl and shinyapps packages?

-Andy

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/b0ffd748-288c-4bfe-b9c1-0c304af7a568%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Seth Green

unread,
Jan 5, 2015, 3:46:32 PM1/5/15
to Andy Kipp, shiny-discuss
No luck.  Just tried the following:

`
> install.packages("RCurl")
Warning in install.packages :
  downloaded length 227 != reported length 227
Installing package into ‘C:/Users/Seth/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
Content type 'application/zip' length 2703917 bytes (2.6 Mb)
opened URL
downloaded 2.6 Mb

package ‘RCurl’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\Seth\AppData\Local\Temp\Rtmp2Lwfdj\downloaded_packages
> library(devtools)
> devtools::install_github('rstudio/shinyapps')
Downloading github repo rstudio/shinyapps@master
Installing shinyapps
"C:/PROGRA~1/R/R-31~1.2/bin/x64/R" --vanilla CMD INSTALL  \
  "C:\Users\Seth\AppData\Local\Temp\Rtmp2Lwfdj\devtools136c7a2f4\rstudio-shinyapps-d14a5d9"  \
  --library="C:/Users/Seth/Documents/R/win-library/3.1" --install-tests 

* installing *source* package 'shinyapps' ...
** R
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (shinyapps)
> shinyapps::setAccountInfo(name='seth127', token=<>, secret=<>)
Error in function (type, msg, asError = TRUE)  : 
  error setting certificate verify locations:
  CAfile: C:/Users/Seth/Documents/R/win-library/3.1/shinyapps/cert/cacert.pem
  CApath: 
Timing stopped at: 0.03 0 2.48
`

Andy Kipp

unread,
Jan 5, 2015, 4:26:10 PM1/5/15
to Seth Green, shiny-discuss
Does the file exist?

C:/Users/Seth/Documents/R/win-library/3.1/shinyapps/cert/cacert.pem

Seth Green

unread,
Jan 5, 2015, 4:42:17 PM1/5/15
to Andy Kipp, shiny-discuss
I does.  I found it and managed to open it in RStudio, but I can't seem to make much sense of it all.

Starts like this and then continues on to a bunch of certificates and tokens, etc.:

`
##
## ca-bundle.crt -- Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Sat Dec 29 20:03:40 2012
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt).  This file can be found in the mozilla source tree:
##
## It contains the certificates in PEM format and therefore
## can be directly used with curl / libcurl / php_curl, or with
## an Apache+mod_ssl webserver for SSL client authentication.
## Just configure this file as the SSLCACertificateFile.
##

# @(#) $RCSfile: certdata.txt,v $ $Revision: 1.87 $ $Date: 2012/12/29 16:32:45 $
`

Any thoughts on what to do with that would be much appreciated!
Thanks,
Seth

Seth Green

unread,
Jan 6, 2015, 10:11:49 AM1/6/15
to Andy Kipp, shiny-discuss
Andy or anyone else,
Any other ideas on what to try?  I'm really hitting a brick wall here and I have to deploy this App fairly soon.
Any help is mostly greatly appreciated.
Seth

Andy Kipp

unread,
Jan 6, 2015, 10:16:27 AM1/6/15
to Seth Green, shiny-discuss
Seth,

Did you restart R after upgrading RCurl?

-Andy

Seth Green

unread,
Jan 6, 2015, 10:34:23 AM1/6/15
to Andy Kipp, shiny-discuss
Yes.  Restarted the whole computer in fact.  Any thoughts on what to do with that file it references?  Should I delete it and then see if shiny automatically downloads a new one when I try to run it?

Should I uninstall shiny altogether?
thanks,
S

Andy Kipp

unread,
Jan 6, 2015, 10:47:49 AM1/6/15
to Seth Green, shiny-discuss
The file defines a certificate authority list for the RCurl package. 

You can try replacing the file with the one from:


Also make sure the file has permission to be read.

-Andy

Seth Green

unread,
Jan 6, 2015, 11:27:42 AM1/6/15
to Andy Kipp, shiny-discuss
Yes, I just tried to replace it with that one and the same issue happened.  I checked and the security seems like I'm allowed to read and execute and everything.  I'm staring at this error, just wondering what it could mean:

Error in function (type, msg, asError = TRUE)  : 
  error setting certificate verify locations:
  CAfile: C:/Users/Seth/Documents/R/win-library/3.1/shinyapps/cert/cacert.pem
  CApath: 
Timing stopped at: 0.86 0.12 1.2

Is there something obvious I'm missing?  The path is right.

When I click on Tools -> ShinyApps it shows me as a connected user.  Then I tried to just click Deploy App through that menu and got (almost) the same error.

Preparing to deploy application...Timing stopped at: 0.28 0.05 0.4 
Error in function (type, msg, asError = TRUE)  : 
  error setting certificate verify locations:
  CAfile: C:/Users/Seth/Documents/R/win-library/3.1/shinyapps/cert/cacert.pem
  CApath: 
Calls: <Anonymous> ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

Seth Green

unread,
Jan 7, 2015, 4:59:03 PM1/7/15
to Andy Kipp, shiny-discuss
OK, I've tried a few more things are still get the same error:

I uninstalled shiny and shinyapps with remove.packages(), then reinstalled

I logged out on my computer and logged back in as the administrator.  Tried it there, same error.

I opened a new shinyapp.io account so that I'd have a different token.  Same error.

I have not yet tried uninstalling RStudio from my computer and then reinstalling, but I'm tempted to go that far.  

Any other thoughts on what could be the issue or should I just give that shot?  Any kind of global settings on my computer that could be screwing it up?  It's a Dell Vostro 3450, i5 processor, running Windows 7.
S

Seth Green

unread,
Jan 7, 2015, 6:40:00 PM1/7/15
to Andy Kipp, shiny-discuss
Holy shit, I fixed it with one line of code:

options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))

I'm not even sure what that means, but it was on a discussion board about someone getting a similar error when they tried to get stuff off of Twitter on a mac.  They said, "I tried this code that was supposed to work for Windows, but it didn't work for me."

I tried it anyway and it work.  Hallelujah.
Thanks for all of you help.
S

Andy Kipp

unread,
Jan 7, 2015, 7:46:17 PM1/7/15
to Seth Green, shiny-discuss
Seth, Glad you got it working I was pretty stumped. 

Can you send the following to see if we can track this down:

R Version
R Studio Version
RCurl Version
ShinyApps version

Thanks
-Andy

Seth Green

unread,
Jan 8, 2015, 7:19:57 AM1/8/15
to Andy Kipp, shiny-discuss
Andy,
Thanks for looking into that.
I'm using:
Windows 7
RStudio Version 0.98.978 
R Version 3.1.1
I reinstalled shinyapps and shiny and RCurl during this whole fiasco and nothing changed so I guess I'm using the most recent version of all of those.

Best of luck and thanks again for all the help.
Seth
Reply all
Reply to author
Forward
0 new messages