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

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.

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?)

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/

R Studio crashing not at initialization. Error: Error occurred during transmission

Some context on my environment:
I am running R Studio in a docker container called rocker/verse.
I downloaded this dataset from Kaggle, which has about 470 MB.
When working with it, at some point RStudio restart. It does't happen after a specific call, and I've seen the same problem when working with other projects. Though it is not related to my code, I am posting it bellow.
library(data.table)
fraud<- fread("path.csv")
fraud1<- sort(sample(nrow(fraud), nrow(fraud)*.7))
train<- fraud[fraud1, ]
test<-fraud[-fraud1, ]
Usually on the console this message is printed:
Error: Error occurred during transmission
And, this pop up is also showed:
I have no idea what is causing it. I would appreciate any help.
Delete the .Rhistory files associated with the installation and any open project.
You have a problem with your user data files for Rstudio. Follow the hints given here: https://community.rstudio.com/t/rstudio-server-error-occurred-during-transmission/84258 and here: https://support.rstudio.com/hc/en-us/articles/218730228-Resetting-a-user-s-state-on-RStudio-Server.

Rshiny publish error: inferAppPrimaryDoc Execution halted

I created an Rshiny APP on my Mac and tried to upload to shinyapps.io
However, when I press 'Publish' button at the top right corner, it shows an error.
Preparing to deploy application...DONE
Uploading bundle for application: 609021...Error in inferAppPrimaryDoc(appPrimaryDoc = appPrimaryDoc, appFiles = appFiles, :
Application mode static requires at least one document.
Calls: <Anonymous> ... withStatus -> force -> bundleApp -> inferAppPrimaryDoc
Execution halted
This problem has been solved. See the first answer.
But now, I have another problem.
I can publish it, but the app cannot show the graphs.
I check the log and it says,
Warning: Error in : Aesthetics must be either length 1 or the same as the data (1): x, y, label, vjust, fill
Also, there is another warning,
Warning in Ops.factor(Year, start) : ‘>=’ not meaningful for factors.
It is pretty strange because when I run the app on my own laptop, it works super well. Please help...
Thanks,
Weichen
You don't have to split your code to ui.R and server.R.
Here is how I solved it on Rstudio:
I created a new Shiny app.R file.
This creates a new folder inside the working directory. I copied all data files I use inside my app into that folder.
I copied and pasted my whole code into the new app.R file on Rstudio.
I clicked Publish and I chose all the data files I use together with the app.R for upload.
It worked. I am not sure why it wasn't working before even though I was still choosing the right files together; I guess because they weren't in the right folder for the Shiny app.
edit: don't forget to Save the app.R file before publishing
Solved.
At first, I simply execute the shiny.R (the whole code) Wrong!
Try this. Create two r files under the same directory.
ui.R
server.R
and then executive shiny.R
You would see an amazing thing happen.
Solved the second problem.
Change the type of 'Year' to numeric by as.numeric
However, I still cannot understand because I can run app on my own laptop.
BTW, the logs in shinyapps.io help me target the problem.

Error deployApp when uploading bundle for application - shinyapp

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-

Resources