Shiny Deployment error - cannot open file '....R': No such file or directory Error in value[[3L]](cond) : cannot open the connection

I'm trying to deploy my Shiny app into "shinyapps.io". And I successfully deployed from my RStudio side as shown below.

> deployApp()
Preparing to deploy application...DONE
Uploading bundle for application: 408175...DONE
Deploying bundle: 1552865 for application: 408175 ...
Waiting for task: 545511722
  building: Parsing manifest
  building: Building image: 1569857
  building: Fetching packages
  building: Building package: speff2trial
  building: Building package: dynpred
  building: Installing packages
  building: Installing files
  building: Pushing image: 1569857
  deploying: Starting instances
  rollforward: Activating new instances
  success: Stopping old instances
Application successfully deployed to 

https://jystatistics.shinyapps.io/master_thesis_shiny/

However, when I try to open in the web, it shows the error message as below.
I don't know why it is showing error message. Can anyone help with this error message?
Thank you!

# An error has occurred

The application failed to start (exited with code 1).

`Attaching package: ‘shinyjs’

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

    runExample

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

    removeClass, show


Attaching package: ‘DT’

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

    dataTableOutput, renderDataTable


Attaching package: ‘gplots’

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

    lowess


Attaching package: ‘ggplot2’

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

    autoplot

Loading required package: ggpubr
Loading required package: magrittr
Warning in file(filename, "r", encoding = encoding) :
  cannot open file 'QSE.R': No such file or directory
Error in value[[3L]](cond) : cannot open the connection
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted`

It seems you try to source an R script that is not found on the server, so that may not have push in the deployement bundle, or may not be in the correct directory relatively.

  • Can you check what is inside the bundle that has been publish ? Does all the needed files are selected and included in what is sent to shinyapps.io ?
2 Likes

I just republished my app to shinyapps.io with different project name and it is working now somehow.

But this time I only uploaded "R" file that is relevant to my project. I guess the previous error message is related with my other app.R file.

Thank you for your help @cderv

2 Likes

Nice!

When you first published an app, some metadata about the deployment are stored locally (in a rsconnect folder I think). Those information are retrieve each time you try to republish from the same file. It is why there could be some saved info. When you have several files to deploy separately in a project, it could explain why there could be mixing up. The advice is to have "one deployment = one project" rule, but you can do multiple deployment = one project if you look after what is really deployed.

Glad it works!

2 Likes