Error deployApp when uploading bundle for application - shinyapp - r

I'm trying for the first time to deploy an App on ShinyApp.io and I manage some issues do it.
I ran the command :
>shinyapps::deployApp('C:/Users/Karim/Documents/test')
And the following message appeared :
Preparing to deploy application...DONE
Uploading bundle for application: 66633...
Error in digest::digest(file.path(appDir, file), algo = "md5", file = TRUE) :
The file does not exist: C:\WINDOWS\TEMP\RtmpugxfSW\fileabc59e7164e/..
I noted that the file mentioned (C:\Windows\Temp...) does exist and contains ui and server files. Yet I don't know which file is missing.
I tried to see if there was no similar cases in the forum by I didn't find similar mistakes.
If anyone know how to solve this error or guide me.
Thank you in advance.
Karim.

Try using relative rather than absolute paths,
https://support.rstudio.com/hc/en-us/articles/229848967-Why-does-my-app-work-locally-but-not-on-shinyapps-io-

Related

sharing shiny app with renv throws error due to bslib

I wanted to make internally sharing/locally launching a shiny app developed with the {golem} framework a little more robust.
Hence, I used the renv package and installed the shiny app as a local package into a project folder.
I proceeded as follows (thanks #Kat for the suggestion):
initialize renv using renv::init(bare = TRUE)
renv::install("my_local_package")
renv::snapshot(type = "all")
renv::isolate()
Writing a launch file consisting of:
library(golempackage)
renv::restore()
golempackage::run_app(options = list(launch.browser = TRUE))
Share folder.
However, when launching the shiny app on a different computer (or a docker testing environment), I get the following error caused by the package bslib. Same happens when I delete my cache:
An error has occurred!
File attachments must exist: 'C:/Users/XYZ/AppData/Local/R/cache/R/renv/cache/v5/.../bslib/lib/bs3/assets/fonts'
Note: this error even occurs if I set the cache to be project-local and share it inside the project folder.
However, now the error message does not reference the global but the project-local cache. Unfortunately still as an absolute path which throws an error for other users.
This is all super weird and I have not the slightest idea why this occurs.
I would like to avoid removing bslib.
As far as I can see, the error is coming from the sass package, e.g.
https://github.com/rstudio/sass/blob/f7a954027447dd0b9826ec01c7084c89a6e64fcc/R/layers.R#L442-L443
While I don't know exactly know what's going on, you could probably use the R debugger to check why that's failing. (Does the referenced folder exist in both cases? Are you expecting renv to be using the cache in the second case?)

Deploying shiny app -> dependencies in this file will not be discovered

I know I'm not the only one with this problem but I have tried several solutions and nothing has worked yet. When I'm deploying my shinyapp (that works perfectly on Windows 11 and 10) i get this warning:
Warning messages:
1: In fileDependencies.R(file) :
Failed to parse C:/Users/nicol/AppData/Local/Temp/RtmpQF8uhX/file438c489067a3/app.R ; dependencies in this file will not be discovered.
I have tried saving my app as a UTF-8 file (there are German Umlauts in it) in RStudio and I have tried to use this as the first line of my code:
options(encoding = "UTF-8")
I deploy on the Rstuido GUI. Maybe that's the problem. But I don't understand how to deploy through the commandline.
Thx for your help
Found a solution. You have to deploy your app through the commandline and use this:
tmp.enc <- options()$encoding
options(encoding = "UTF-8")
rsconnect:: deployApp()
This can be a bit complicated because you can't chose from the GUI what you want to upload to shinymaps.io but at least it works.

Getting an error when trying to publish my shiny app to the server for others to view

My shiny app runs fine in my local environment, however, when I go to publish it online I get the error "An error has occurred. The application failed to start. Contact the author for more information."
When I review the error I get:
"Line 36 Paths should be to files within the project directory"
"Line 38 Paths should be to files within the project directory"
Here is the code for both of those lines:
36.
data <- read_excel("~/data/T Version/Values for R/Pricing 081021.xlsx") %>%filter(Date_of_Indication == max(Date_of_Indication))
38.
portfolio <- read_excel("~/data/T Version/Values for R/Portfolio for R 081021.xlsx")
I'm a bit stumped as to why it isn't working, any help would be much appreciated.
Thanks
The online app doesn't have access to your local directory. You need to either include the data in the code itself with something like dput() or include the URL to the raw data file via GitHub or something similar.
For example, I use code like this to read a csv from my GitHub repository for my online apps:
dat<-read.csv("https://raw.githubusercontent.com/UserName/RepoName/DataInput.csv")
But note that the repo has to be set to be publicly available (not private).
A potentially helpful link: https://shiny.rstudio.com/tutorial/written-tutorial/lesson7/

Libxls error : unable to open file this error was for R

While using R , my file is saved on desktop When I run
This code it gives me the above error
Setwd(“users/user name/desktop/“)
Isuggest that to check the work directory, and it is better to read any file on the same work space you choose
from session -> set working directory ->choose directory
I hope my Answer help you.

Shiny App Error: /v1/applications/ 400 - Validation Error Execution halted

Hi I'm having a million problems trying to publish my app to shiny.io.
Firstly, I have Rtools 3.2 installed in my computer and set to the Path, but it is not recognized in the registry. Nevermind, this code should fix it:
install.packages("installr")
library(installr)
install.Rtools(choose_version = FALSE, check = TRUE, use_GUI = TRUE,
page_with_download_url = "http://cran.r-project.org/bin/windows/Rtools/, keep_install_file=TRUE")
install.packages("devtools")
library(devtools)
devtools::install_github('rstudio/shinyapps')
Next, to deploy my app to my shiny.io account:
library(shinyapps)
shinyapps::setAccountInfo(name='xxxx', token='xxxxxxxxxx', secret='xxxxxxxx')
Then my app starts running in a browser, and I click publish to my shiny account. However, when the app is being deployed, it shows the following error:
Preparing to deploy application...Error: /v1/applications/ 400 - Validation Error
Execution halted
Any ideas what the problems may be? Thank you.
I had the same error returned. In my case the problem was the name of the app itself. Deployed apps must have names at least 4 characters long with no spaces.
Setting an application name solved this problem for me. My application directory contained a space.
deployApp(appName = "myapp")
I had the same problem, however, my app name was fine and even adding 'appName =' did not help. Just a side note that this issue came up because I changed the name of my folder in effort to change the name of my app in shinyapp.io
The only thing that worked for me is publishing through the "Publish" button of Rstudio on upper right. I would recommend publishing using that instead of command. You can select files you do not want to publish within the App folder and you can publish the app under a different name then your local name.
I also had similar errors and the issue was resolved after I changed the name of the directory that holds the "app.R" file from only 3 characters to more than 4 characters.

Resources