Running app successful in R studio but not in Shiny server - r

My operation system is ubuntu.
I run a shiny app successfully in rstudio.
I have copied all files in the shiny server file. But when I try to run the app from shiny server I see in browser this error:
ERROR: An error has occurred. Check your logs or contact the app author for clarification.
However when I go to logs I can't find log for the specific app.
Is there any workaround for that kind of issues?

I can't comment so I'm putting this as an answer. Are all of the packages your app needs installed on the server?
Logs are not stored if the R process end successfully, and if I remember right that includes when packages are not installed.
From the Shiny Server Configuration Guide
A log file will be created for each R process when it is started.
However, if a process closes successfully, the error log associated
with that process will be automatically deleted. The only error log
files that will remain on disk are those associated with R processes
that did not exit as expected.
You can override this behavior using the preserve_logs configuration
option. If you set preserve_logs true; in your configuration file,
Shiny Server will never delete the logs from your R processes,
regardless of their exit code. Be aware that this will cause log files
to accumulate very quickly on a busy server. This setting is only
recommended for debugging purposes; if it were to be enabled on a
production server, you would need to pay close attention to the
rotation and archiving of logs to prevent your file system becoming
overwhelmed with log files.

Related

Unsure where image_write downloads to in shinyapps.io

I'm attempting to make a public shinyapps.io website, and I'm trying to use image_write to create a file into a local directory.
The following code works on my local R studio code:
image_write(im.resized, path = paste0(output_file_directory, file_name), format = "jpg")
When I run the code on the shinyapps.io website, the code runs without error, but I'm not sure where it downloads the file to. I know that the output_file_directory part isn't the issue, so I'm a little lost. Any help would be much appreciated!
On shinyapps.io it is not possibly to store permanently data, due to:
"Shinyapps.io is a popular server for hosting Shiny apps. It is designed to distribute your Shiny app across different servers, which means that if a file is saved during one session on some server, then loading the app again later will probably direct you to a different server where the previously saved file doesn’t exist."
See here:
https://shiny.rstudio.com/articles/persistent-data-storage.html

ERR_EMPTY_RESPONSE shiny server

I am currently hosting a number of shiny apps on a shiny-server open source on a centos7 distro. All the apps were/are working fine but for one of the apps when I try to go to the url I get the following message:
This page isn't working
<ip.address> did not receive any data.
ERR_EMPTY_RESPONSE.
All the other shiny apps hosted on the same shiny server are working just fine. I checked /var/log/shiny-server and there is no log file for this App. As the other apps are working fine, I dont think its a port issue.
The only difference between other apps and this one is that it was used the most by its users. Is there some restriction/limit on shiny-server for runtime? I can't figure out what the problem is. The app runs fine on RStudio Server and if I copy it into a new directory in /srv/shiny-server/ with a different name, it also works fine.
A couple of thoughts:
If a process closes successfully, then shiny deletes the log files. So it's possible you may be missing some log files. You may override this with preserve_logs, see here. Your users may be triggering some error through their interactions with the app, but other sessions are successful, so shiny deletes the log files.
Shiny creates one process per app be default, but an unlimited number of session (see here). This means that if your app is the one that is used the most by users, each user is generating a new session. And if the app is computationally intensive, then some of the user sessions may be getting backlogged which might trigger the ERR_EMPTY_RESPONSE. You can fix this by using Docker to spin up a process for each user. Here are some options, I've found shinyproxy to be the most intuitive.

Shiny R app error "too long to respond" but works from different directory

My organization runs Shiny apps over a server that pulls the app.R files from a directory. When I go to the internal site for the directory I get an error: "An error has occurred The application failed to start. The application took too long to respond."
Runs local, and copy/paste from new folder in different directory as well too. Unfortunately cannot provide reproducible example sorry.
This has nothing to do with shiny in this case.
You should check with your company. They may have some identification
problem or an identity management software that is blocking the access from your shiny app. This is why your shiny app waits so long to have access to the directory but fails at the end.
In your place, I would check if there are any security barriers made
by the company to secure their files. I am quite sure this is the
problem and you have to request or ask for permissions to have access from shiny to that directory.
--------- UPDATES for comments ---------
If you tried the same exact app with another directory and it worked well, then it's definitely a problem with the directory and not shiny. Most probably it should be with access permissions monitored by the IS admin. So yes, your understanding is correct!
In order to avoid any problem in the future, keep everything as much as possible inside UI and server and avoid outside processing if you can. It's a bad practice IMHO.

Converted UWP... Nothing Happens

I have converted a Win32 Application to UWP using MakeAppX and it doesn't seem to run. When I click the icon in the start menu literally nothing happens except a busy icon briefly appears on the cursor.
I completed the same process with Notepad++ and all it's DLLs and that worked fine (using the exact same manifest file, just changing the exe)
My questions are:
Where does the UWP save files that it creates/temporary files etc? If I run an executable and it generates files next to it, where would that be when you run a UWP?
Can I set that location in the AppxManifest?
Is there anyway to see if it has run correctly or not?
Edit:
Could this be a file permissions issue? My application needs to write to 'C:\MyFolder' & creates a folder with a load of files next to the executable upon startup and that doesn't happen.
So looking into this a bit more I came across this blog which discusses preparing for conversion. I think the above file accesses probably contravene the following:
Your app writes to the install directory for your app. For example, your app writes to a log file that you put in the same directory as your exe. This isn't supported, so you'll need to find another location, like the local app data store.
This looks like a fairly halting issue, am I correct in that assumption?
If your app is writing to the install directory you will need to change that code to write to your local app data folder instead, as the preparation guide calls out.
Write operations to the install directory are not allowed in order to ensure the ability for the app deployment stack to perform seamless, differential updates and clean uninstalls of your app.
Btw, to debug through your app launch failures you can do the following in Visual Studio: Debug -> Other Debug Target -> Debug Installed App Package -> select your app from the list of installed apps.

Running a compainion application at install

I have two WPF applications in the same solution. One is a configuration helper for the other and needs to be run before the 'big' app is run. In the VS Setup project I have included the Primary Output from both applications.
I want to run the configuration helper during the Commit phase of setup so I added a Custom Action consisting of the Primary Output of configuration helper and marked the Installer Class as false.
When I run the resulting msi, both applications are installed in the same folder as desired, but I then get an error that 'a program run as part of the setup did not finish as expected.' The msi then uninstalls.
I was hoping the configuration helper would be kicked off as the msi exits, but would also be happy with the installer hanging open until the configuration helper exits.
What am I missing?
The program you ran as a custom action has failed, probably crashed. It may need some extra error checking or tracing to see what's going on. Programs that run as custom actions are not in the same environment as running them from the interactive user's desktop. The working directory is probably not what you expect (so file paths must be specified in full) and it's probably running with the system account, because that's the way Everyone installs work, so any assumptions about user locations (including the interactive user's desktop, user folders, access to the network, access to databases, ability to show forms) will be wrong and are likely to be failure points. It's better to run configuration tools like this when the app first starts because you are now running in a normal user environment.

Resources