Shiny app deployment error - Error in value[[3L]](cond) : Cannot open data source

... Iam deploying my shiny app to shinyapps.io & all my app files(app.r,www) are all stored in my dropbox. I have loaded the rsconnect command then published the app to my account. The deployment process is successful but when I go to my app url I get the following error: Any ideas on how to solve this?

An error has occurred
The application failed to start (exited with code 1).


Attaching package: ‘DT’

The following objects are masked from ‘package:shiny’:

    dataTableOutput, renderDataTable


Attaching package: ‘shinydashboard’

The following object is masked from ‘package:graphics’:

    box

Loading required package: sp
rgdal: version: 1.3-4, (SVN revision 766)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 2.1.3, released 2017/20/01
 Path to GDAL shared files: /usr/share/gdal/2.1
 GDAL binary built with GEOS: TRUE 
 Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
 Path to PROJ.4 shared files: (autodetected)
 Linking to sp version: 1.3-1 

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union



Attaching package: ‘raster’

The following object is masked from ‘package:dplyr’:

    select

Error in value[[3L]](cond) : Cannot open data source
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

I am also trying to deploy my shiny app though I am not using the dropbox call function & I get this error:

Preparing to deploy application...Error: HTTP 404
GET https://api.shinyapps.io/v1/applications/416524
Not Found
Execution halted

This is just a by the way question on the function to call the files from dropbox.
For me I have my app.r & www files in my dropbox & I call the files normally in my app i.e. readOGR/read.csv but I don't know how to use the dropbox call function.
I have 4 shape files & 2 csv files. I wanted some guidance on how I can call all these files using the dropbox call function.

Could you share the line(s) of code that are attempting to connect to a data source?

This is typically when you have deleted your application, but there is still a reference to it locally in rsconnect/shinyapps.io/<account name>/<application name>.dcf. Remove that file and deploy again.

I was able to solve this through redeployment but the "cannot connect to data source" error persists.

All this code is in app.R while my data is in www folder in my dropbox. I was thinking of using rdrop2 to make connection but I have no idea of how I can load all the 4 shape files & 1 csv file.Here is the code:


#loading elevation shape file
countor<-readOGR(
  dsn="C:/Users/Dropbox/www/Elevation Contours",
  layer="25m interval rough contours",encoding = 'UTF-8')


#loading sewer shape file
sewer<-readOGR(
  dsn="C:/Users/Dropbox/www/Sewer map",
  layer="Sewer line WGS84",encoding = 'UTF-8')

#loading LIAs shape file
mp<-readOGR(
  dsn="C:/Users/Dropbox/www/LIAs",
  layer="m1",encoding = 'UTF-8')

#loading  water treatment plants shape file
treat<- readOGR(dsn="C:/Users/Dropbox/www/treatment plants",
                layer="Nk_Sewer_newcrs",encoding = 'UTF-8')

#loading nakuru data
nakuru<-read.csv("C:/Users/Dropbox/www/nak3.csv",encoding = 'UTF-8')

All of those are absolute paths that works on your local Windows machine. They do not exist on shinyapps.io.

You will need to use an R package or other mechanism to retrieve the files if you are not including them in the bundle you are uploading.

Which R package or mechanism should I use? That is where I am stuck.

I don't have a particular recommendation, but if you don't turn up anything by searching the Community for Dropbox then I would suggest a separate post that solicits recommendations for such a package.

The problem was with the paths I was able to change it to relative path & it worked!!

1 Like

3 posts were split to a new topic: Shiny deploy error - Error in value[3L] : object 'full_set' not found

2 posts were merged into an existing topic: Shiny deploy error - Error in value[3L] : object 'full_set' not found

Hi Brian!
I´m having this very same issue when I try to upload my shiny app. Can you explain to us the solution you found? An example of how you changed the path of the shape files would be great.

Thanks

The answer is to use relative paths in your R script. That means that the path uses ../ or ./ to locate the file relative to the working directory of the script.

For example, if I have C:\RScripts\app.R and it needs some C:\data\mnist.csv, the path you should give to the R script is ../data/mnist.csv.

OR

Use rsconnect::deployApp from the R console and specify an appFiles named argument containing the full paths of all the files your application needs to run.

Example: rsconnect::deployApp('C:\RScripts\app.R', appFiles = c('C:\data\mnist.csv'), account = 'scott@rstudio.com', server = 'shinyapps.io')

See https://www.rdocumentation.org/packages/rsconnect/versions/0.8.12/topics/deployApp or enter ?deployApp in the R console for more information.

1 Like