Why do I get an error when deploying a shiny app? - r

When I try to publish my ShinyApp with shinyapps.io,
I keep getting the following error message: 'Application mode static requires at least one document'.
Here are some of the fixes, I've implemented:
create a different directory with all dependent files and a copy of the R-script.
re-created custom functions from my local environment within the app
Furthermore, in 'read.csv' I refer to the files directly without specifying the directory, in case this might be the culprit.
Do you have any idea, what the issue might be?

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

Problem with directory when deploying app on shinyapps

I wrote a golem app and wanted to deploy it on the shinyapp.io. Unfortunately, every time I try to do it the following error comes up (in logs):
Warning in loadSupport(appDir, renv = sharedEnv, globalrenv = NULL) :
Loading R/ subdirectory for Shiny application, but this directory appears to contain an R package. Sourcing files in R/ may cause unexpected behavior.
All files related to my project are stored in one directory, where my golem project was initially created. I also checked and set manually working directory to 'R' folder (where app_server and app_ui are stored). Unfortunately when I deploy my app the mentioned error comes up again. Moreover, every time I close my project in RStudio I save workspace image to '.RData' file (this file is also stored in main directory) - maybe here is a problem (but I also tried to deploy w/o this file and it failes either). I really don't know where the problem lies and what this error means.
Interestingly, regular (single) app.R can be deployed on shinyapps without a problem.
Since Shiny 1.5, if you run a shiny app with a subdir called R/, it will load every function stored in it automatically. You can avoid this setting the autoload option to FALSE, doing:
options(shiny.autoload.r=FALSE)
What I do (I'm not sure whether it is best practice) is setting that up just before calling shiny::runApp(). For intance, I usually have a launch() function in my package, which calls shiny::runApp(). Including the option within this launch() function should fix the issue.
Nonetheless, the message is a warning, not an error, and it is possible that everything is working properly in your shiny app.

Arrange FireStore Cloud Functions in multiple files

I have noticed a strange behaviour in FireStore Cloud Functions that if try to break my code up into separate files, I start to get this error:
info: Worker for app closed due to file changes.
I just created a simple express server and hosted it in a cloud function and was emulating it locally as described here.
https://www.youtube.com/watch?v=LOeioOKUKI8&t=244s
I even wrote tests for the same. Everything was working fine until I split the source code of my express app into individual routes (contained in separate .js files).
The only thing that message means is that the emulator noticed when a code file changed, and performed a hot reload of that code. Note that it's just an "info" level message, not an error and not even a warning.
If your project is not working the way you expect, then edit your question with the symptoms you're observing, along with the code.

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.

Error whent trying to deploy shiny app: multiple existing deployments from this application directory already exist

When trying to deploy my shiny app
shinyapps::deployApp('C:\\MyProgramProject\\MyApp')
I get the following error:
Error: Unable to deploy using default arguments (multiple existing deployments from this application directory already exist). Please specify appName and/or account name explicitly.
I have a similar app under an entirely separate directory with a different shiny account which was uploaded from the separate directory. I made sure that I entered the correct token for the account and I can see in the shiny server of the account I want to upload to that there are no applications there at all. I also copied the ui.R and server.R files to a new subdirectory called Deployand tried to upload from there with identical results. Again, the tokens and directory paths are correct.
The reason we want to deploy to the new account is because we have had a lot of traffic and want to set up a new paid account with a higher allowance but need to make sure it works first.
Try removing any directory called rsconnect or shinyapps from your application folder.
You can also try calling:
deployApp(appName="my-app-name", account="my-account-name")

Resources