Fatal error when deploying a shiny app with Rstudio - r

I have a shiny app (divided into ui.R, server.R and helpers.R) which works on my local machine. The app does not load any libraries besides library(shiny). I am unable to deploy it to shinyapps.io. That is what I do
I log myself into shinyapps.io (via the website www.shinyapps.io)
I run library(rsconnect) on the R console.
I copy the Tokens code (rsconnect::setAccountInfo...) from the www.shinyapps.io page into the R console and run it.
I run the app in Rstudio (1 warning: Warning in body(fun) : argument is not a function). The app runs as expected.
I use the "publish" button in the app window and get a new window saying: "R session aborted. R encountered a fatal error. The session was terminated"
Sorry, I have no idea about where to look for the error. Can you give me a hint what causes the problem? Which additional information would you need to help me?
Thanks a lot!
update: I just saw that there is a second "publish"-button in Rstudio if you have one of the app-files in the editor (without running it). When I use this one, I get the same crash, but with some more information: unexpected exception: boost::filesystem::unique_path: key is not valid in specified status (sorry, that is my own translation from German).

One way of deploying an app to the shinyapps.io server is not to use the button in RStudio, but to do it via the console. Here the steps that are working for me now (RStudio 1.0.143):
Log in on shinyapps.io (via the website www.shinyapps.io)
Run library(rsconnect) on the R console.
Copy the Tokens code (rsconnect::setAccountInfo...) from the www.shinyapps.io page into the R console and run it.
Run rsconnect::deployApp('path to your app') on the R console.
Pushing the publish button in RStudio still results in a crash of R.

Related

Was working on a R project and completed the code but then Im getting error , application could not start in shinyApp. RSTUDIO

FULL CODE FOUND AT
(https://www.writeurl.com/text/foupmfj7m1u3yzc01ozy/0x6kz2fgmoxrwzdnorwt/shym4opkyq1k5b0xi6ej) Uploading files and plotting selected variables | Use the following code to create a shiny app for uploading a file on a user's computer. When this code is deployed in shinyApp getting error stating application failed to start When I try to deploy the code in shiny app it is throwing an error -(https://alvinsamj.shinyapps.io/project-4/) The code contains problem statement that is commented in the code and self explaining. I got this as a part of a project but couldn't get a solution. This is the part i did !!`

Popup window not appearing in R Shiny app

I am trying to deploy a Shiny app via https://www.shinyapps.io, but am experiencing difficulty. Note: things work fine locally on my machine.
Specifically, my app calls one of my R packages and runs said package under the hood. The package prompts a user to input a FASTA file via base::file.choose().
My problem is similar to the one outlined here
Error when using file.choose() in Shiny Web App (deployed online)
Is there a simple way to solve this without having to use shiny::fileInput()? I don't want to have to change any of my package code.
My app is here: https://hacsim.shinyapps.io/hacsim-rshiny-app/
To reproduce the error I get, click "RUN SIMULATION", then navigate to "Sub interface" and click "Run". A pop-up window should appear. Instead the error
character(0)
Error: An error has occurred. Check your logs or contact the app author for clarification.
appears in the Result panel.
Any help is welcomed and greatly appreciated.

Script using GPU throws error when running app on Shiny server

I have written some code in R using the Shiny package. The app runs alright when running shiny::runApp() from RStudio.
I've tried to host the app on a Shiny server and the GUI starts up correctly. However, a plot should appear on the right when the button "Enviar informacion" is clicked. (You can see how the app looks here, but it won't work though because that link is not on Shiny server but on Shinyapps.io).
The relevant part of the logfile is the following:
Listening on http://127.0.0.1:38327
Loading required package: Rcpp
Warning: Error in [: subscript out of bounds
211: FUN [/srv/shiny-server/spike_sorting/server.R#82]
210: apply
209: cluster_som_h [/srv/shiny-server/spike_sorting/server.R#82]
...
So the error is inside the function cluster_som_h. After trying some stuff, I found out what is causing the error, but don't know how to fix it. Inside this function, I make use of the function Rsomoclu.train() from the package Rsomoclu, with kernelType = 1. This means that the function is run on the GPU. If I set kernelType = 0, then the app works okay with both runApp() and from the Shiny server. So that's where the problem is: for some reason, running the function on the GPU is not working if the app is run from the Shiny server, but it does work if it is run from RStudio using runApp().
Maybe there is something going on because I have CUDA installed on my computer but when I try to run it from the server something happens. Is there a way to fix this? I believe running the code from this specific computer no matter where on the LAN the app is run would solve this. Is this possible?
After doing some (basic) research, I found out what was happening. I have CUDA installed only in my user in Ubuntu, so I had to change the first line of the file /etc/shiny-server/shiny-server.conf so that the user was the right one:
# Instruct Shiny Server to run applications as the user "my_name"
run_as my_name;

R shiny and rscript.exe

I have tried to make use of a .bat in windows to open and run an r shiny app.
It all works and I even get the listening prompt displayed.
However, no web interface opens.
Has anyone else met this problem and resolved it?

ERROR: An error has occurred. Check your logs or contact the app author for clarification

while publishing app on web getting error called: check your log or contact the app auther.please find above image links
ERROR: An error has occurred. Check your logs or contact the app author for clarification.
if anyone can help me to resolve this error I'd be grateful.
There are multiple reasons for this error. Rstudio has provided multiple reasons (link below) but most common are:
Environment variables not the same in shiny web vs. local (make sure working directory is set to ~/, start a new rsession and run only the ui.R, server.R or app.R and see if you can preview in local before publishing.)
Update libraries to latest versions and hopefully you are not using the libraries that are not yet available in CRAN.
https://support.rstudio.com/hc/en-us/articles/229848967-Why-does-my-app-work-locally-but-not-on-shinyapps-io-

Resources