json interface as data source

104 views
Skip to first unread message

Nico Steckhan

unread,
May 21, 2016, 2:07:57 PM5/21/16
to ShinyApps Users

Hi,

I am trying to build a shinyapp (via https://www.shinyapps.io) that functions as data monitor for my limesurveys...
Basically I am using the json/RPC interface inside limesurvey for enabling data access.

Using my app.R inside RStudio is working great, but I run into problems when I deploy the app to shinyapps.io.
After loading I get a Disconnected from the server. message

I already tried the  limeR package (https://github.com/andrewheiss/limer)
which uses
#### Access LimeSurvey RemoteControl API with R from https://gist.github.com/andrewheiss/fe64718c41991b1620f5
library(httr)
library(jsonlite)
library(base64enc)

access routines via
library("rjson")
library(RCurl)


somehow the session_key is not available from inside shinyapps.io

Who can help ?

Best
Nico

Joshua Spiewak

unread,
May 23, 2016, 9:42:00 AM5/23/16
to ShinyApps Users
What do your logs show?

rsconnect::showLogs()

Nico Steckhan

unread,
May 24, 2016, 4:02:51 AM5/24/16
to ShinyApps Users
2016-05-19T17:16:12.294907+00:00 shinyapps[103059]:     12: fn
2016-05-19T17:16:12.294908+00:00 shinyapps[103059]:     11: doTryCatch
2016-05-19T17:16:12.294909+00:00 shinyapps[103059]:     10: tryCatchOne
2016-05-19T17:16:12.294910+00:00 shinyapps[103059]:      9: tryCatchList
2016-05-19T17:16:12.294911+00:00 shinyapps[103059]:      8: tryCatch
2016-05-19T17:16:12.294912+00:00 shinyapps[103059]:      7: connect$retry
2016-05-19T17:16:12.294913+00:00 shinyapps[103059]:      6: eval
2016-05-19T17:16:12.294915+00:00 shinyapps[103059]:      5: eval
2016-05-19T17:16:12.294916+00:00 shinyapps[103059]:      4: eval
2016-05-19T17:16:12.294917+00:00 shinyapps[103059]:      3: eval
2016-05-19T17:16:12.295228+00:00 shinyapps[103059]: Error in curl::curl_fetch_memory(url, handle = handle) : 
2016-05-19T17:16:12.295231+00:00 shinyapps[103059]:   SSL peer certificate or SSH remote key was not OK
2016-05-19T17:16:12.294918+00:00 shinyapps[103059]:      2: eval.parent
2016-05-19T17:16:12.294919+00:00 shinyapps[103059]:      1: local
2016-05-24T08:00:31.165819+00:00 shinyapps[103059]: Server version: 0.4.3.1780
2016-05-24T08:00:31.165896+00:00 shinyapps[103059]: R version: 3.3.0
2016-05-24T08:00:31.165898+00:00 shinyapps[103059]: shiny version: 0.13.2.9003
2016-05-24T08:00:31.181347+00:00 shinyapps[103059]: rmarkdown version: NA
2016-05-24T08:00:31.181350+00:00 shinyapps[103059]: knitr version: NA
2016-05-24T08:00:31.181352+00:00 shinyapps[103059]: jsonlite version: 0.9.20
2016-05-24T08:00:31.181353+00:00 shinyapps[103059]: RJSONIO version: NA
2016-05-24T08:00:31.181354+00:00 shinyapps[103059]: htmltools version: 0.3.5
2016-05-24T08:00:31.367474+00:00 shinyapps[103059]: Using jsonlite for JSON processing
2016-05-24T08:00:31.374346+00:00 shinyapps[103059]: Starting R with process ID: '11'
2016-05-24T08:00:31.392818+00:00 shinyapps[103059]: 
2016-05-24T08:00:31.392822+00:00 shinyapps[103059]: Listening on http://0.0.0.0:49596
2016-05-24T08:00:31.374342+00:00 shinyapps[103059]: 
2016-05-24T08:00:41.093228+00:00 shinyapps[103059]: Warnung: Error in curl::curl_fetch_memory: SSL peer certificate or SSH remote key was not OK
2016-05-24T08:00:41.098358+00:00 shinyapps[103059]:     53: get_session_key
2016-05-24T08:00:41.098363+00:00 shinyapps[103059]:     10: tryCatchOne
2016-05-24T08:00:41.098350+00:00 shinyapps[103059]: Stack trace (innermost first):
2016-05-24T08:00:41.098359+00:00 shinyapps[103059]:     52: server [/srv/connect/apps/lime2shiny/app.R#18]
2016-05-24T08:00:41.098365+00:00 shinyapps[103059]:      8: tryCatch
2016-05-24T08:00:41.098352+00:00 shinyapps[103059]:     58: curl::curl_fetch_memory
2016-05-24T08:00:41.098361+00:00 shinyapps[103059]:     12: fn
2016-05-24T08:00:41.098371+00:00 shinyapps[103059]:      2: eval.parent
2016-05-24T08:00:41.098354+00:00 shinyapps[103059]:     57: request_fetch.write_memory
2016-05-24T08:00:41.098368+00:00 shinyapps[103059]:      5: eval
2016-05-24T08:00:41.098355+00:00 shinyapps[103059]:     56: request_fetch
2016-05-24T08:00:41.098369+00:00 shinyapps[103059]:      4: eval
2016-05-24T08:00:41.098356+00:00 shinyapps[103059]:     55: request_perform
2016-05-24T08:00:41.098370+00:00 shinyapps[103059]:      3: eval
2016-05-24T08:00:41.098357+00:00 shinyapps[103059]:     54: POST
2016-05-24T08:00:41.098360+00:00 shinyapps[103059]:     13: runApp
2016-05-24T08:00:41.098372+00:00 shinyapps[103059]:      1: local
2016-05-24T08:00:41.098362+00:00 shinyapps[103059]:     11: doTryCatch
2016-05-24T08:00:41.098367+00:00 shinyapps[103059]:      6: eval
2016-05-24T08:00:41.098364+00:00 shinyapps[103059]:      9: tryCatchList
2016-05-24T08:00:41.098664+00:00 shinyapps[103059]: Error in curl::curl_fetch_memory(url, handle = handle) : 
2016-05-24T08:00:41.098366+00:00 shinyapps[103059]:      7: connect$retry
2016-05-24T08:00:41.098666+00:00 shinyapps[103059]:   SSL peer certificate or SSH remote key was not OK

Nico Steckhan

unread,
May 25, 2016, 10:07:01 AM5/25/16
to ShinyApps Users
Noone has an idea?

Nico Steckhan

unread,
May 25, 2016, 10:07:03 AM5/25/16
to ShinyApps Users
Noone has an idea?

Joshua Spiewak

unread,
May 25, 2016, 10:39:57 AM5/25/16
to ShinyApps Users
Given the error message, I would guess that either URL you are trying to fetch has an invalid SSL certificate, or it is signed by a Root CA that is not present in the Rcurl package.
You could look at this posting for ideas for how to work around, perhaps.


On Wednesday, May 25, 2016 at 10:07:03 AM UTC-4, Nico Steckhan wrote:
Noone has an idea?

Nico Steckhan

unread,
May 25, 2016, 11:11:58 AM5/25/16
to ShinyApps Users
I am just using the limeR package which is not using Rcurl, but requires httr and jsonlite package.
https://gist.github.com/andrewheiss/fe64718c41991b1620f5

Interstingly everything works fine from my mac, but not inside shipyards.io

Nico Steckhan

unread,
May 25, 2016, 1:53:12 PM5/25/16
to ShinyApps Users
Thanks Joshua,

as suggested I upload the local working cacert.pem file to shinyapps and than using this code

pemfile = "cacert.pem"
options(RCurlOptions = list(cainfo = system.file("cert", pemfile, package = "shinyapps")))  

..................
now the error is coming from this line :
    res     <- curlPerform(url = rpc$url, httpheader = headers, postfields = body,
                           writefunction = reader$update, headerfunction = header$update,
                           curl = rpc$curl)







#####################################################
following logs now:

2016-05-25T17:41:15.941296+00:00 shinyapps[104335]: Listening on http://0.0.0.0:43207
2016-05-25T17:41:15.738192+00:00 shinyapps[104335]: knitr version: NA
2016-05-25T17:41:15.738194+00:00 shinyapps[104335]: jsonlite version: 0.9.20
2016-05-25T17:41:24.157855+00:00 shinyapps[104335]: Lade nötiges Paket: rjson
2016-05-25T17:41:24.171047+00:00 shinyapps[104335]: Lade nötiges Paket: bitops
2016-05-25T17:41:27.087553+00:00 shinyapps[104335]: Warnung: Error in <Promise>: <not set>
2016-05-25T17:41:27.092396+00:00 shinyapps[104335]: Stack trace (innermost first):
2016-05-25T17:41:27.092398+00:00 shinyapps[104335]:     57: <Anonymous>
2016-05-25T17:41:27.092399+00:00 shinyapps[104335]:     56: fun
2016-05-25T17:41:27.092400+00:00 shinyapps[104335]:     55: <Promise>
2016-05-25T17:41:27.092401+00:00 shinyapps[104335]:     54: curlPerform
2016-05-25T17:41:27.092404+00:00 shinyapps[104335]:     52: server [/srv/connect/apps/pemapp/app.R#68]
2016-05-25T17:41:27.092405+00:00 shinyapps[104335]:     13: runApp
2016-05-25T17:41:27.092406+00:00 shinyapps[104335]:     12: fn
2016-05-25T17:41:27.092407+00:00 shinyapps[104335]:     11: doTryCatch
2016-05-25T17:41:27.092402+00:00 shinyapps[104335]:     53: request [/srv/connect/apps/pemapp/app.R#35]
2016-05-25T17:41:27.092410+00:00 shinyapps[104335]:      8: tryCatch
2016-05-25T17:41:27.092411+00:00 shinyapps[104335]:      7: connect$retry
2016-05-25T17:41:27.092412+00:00 shinyapps[104335]:      6: eval
2016-05-25T17:41:27.092413+00:00 shinyapps[104335]:      5: eval
2016-05-25T17:41:27.092414+00:00 shinyapps[104335]:      4: eval
2016-05-25T17:41:27.092415+00:00 shinyapps[104335]:      3: eval
2016-05-25T17:41:27.092416+00:00 shinyapps[104335]:      2: eval.parent
2016-05-25T17:41:27.092408+00:00 shinyapps[104335]:     10: tryCatchOne
2016-05-25T17:41:27.092763+00:00 shinyapps[104335]: Error in function (type, msg, asError = TRUE)  : <not set>
2016-05-25T17:41:27.092409+00:00 shinyapps[104335]:      9: tryCatchList
2016-05-25T17:41:27.092417+00:00 shinyapps[104335]:      1: local

Nico Steckhan

unread,
May 26, 2016, 6:45:04 AM5/26/16
to ShinyApps Users
OK, when I disable ssl on my apache server, everything is working as wanted.


maybe its the firewall from naturheilkunde.charite.de, so I need a whitelist:


but just for the 443 port?

how could I set up a port 80 tunnel for shinyapps remote access to my database? 
Reply all
Reply to author
Forward
0 new messages