I asked this question in Rstudio Support, but they were pointing me to standard help files and docs, which I've already gone through. I have a shiny app that parses the ui.R file and, along with getParseData and a bit of tidyverse magic, neatly turns the ui into a dataframe where I can store and use metadata like labels, defaults, etc.
When I run locally/in rstudio server, the function works great. However, when I publish to connect, it breaks my app as the getParseData function returns NULL. Reprex below
I have a simple hack -- add an if else is.null to the function above such that when the file runs locally, write it to a feather file and when its published / returning NULL, read the last saved version instead, but that isn't a bulletproof solution.
Any ideas why this isn't working or better solutions would be appreciated!
This probably happens because of the way sandboxing on Connect provides separation between processes and users.
Also, using parsing your source code to define configuration settings sounds like an anti-pattern to me. A better pattern would be to define all your metadata and settings in a configuration file, then let the shiny app itself adjust to the config file.
Yes, I suspect the problem is the here::here() piece. If I remember correctly, I have seen the here package have some weird effects on Connect.
Why don't you try just using a relative path from the base of the Shiny application and see if that fixes the problem?
As a debugging step, I would add debugging statements like message(getwd()) and message(.file) to get a better picture of what is happening inside of Connect. As @andrie mentioned, the sandboxing process may be a part of the problem here... or perhaps something needs to be tweaked in the here package.