0
votes

I'm trying to publish an R Shiny app. It works when run locally, but once published to shinyapps.io produces the following error.

Warning in gzfile(file, "wb") :
  cannot open compressed file '/key.rda', probable reason 'Permission denied'
Error in value[[3L]](cond) : cannot open the connection
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

You can also see the actual page with the error here: https://povertylab.shinyapps.io/ACS-Map-Dashboard/

Though I have tried to reproduce this error it doesn't appear when I publish other apps, and my searches haven't turned up anything. Other things I've tried: publishing from other computers, publishing only global.R, server.R, and ui.R files, and copying files to a new project and publishing from there.

You can find all code for the app here: https://github.com/Poverty-Lab/ACS-Map-Dashboard

I would appreciate any input, even if it's just guidance on what gzfile is and what the error message could mean. Thank you!

2

2 Answers

0
votes

Where is the key.rda file supposed to be? I've looked through your repo and I don't see it, which is probably causing the "cannot open the connection" error.

As a side note, you should probably ignore the .Renviron file; right now anyone can use see and use your key. Make sure you remove it from the history as well.

0
votes

Thanks all. Turns out this was a problem with the way we were handing the api key for the acs package. We were using api.key.install to install the api key inside the app, and one of api.key.install's default arguments is file = "key.rda", and that file apparently could not be found. I'm still not sure why this problem only came up when we published the app, but we got around it by supplying the actual api key to the acs.fetch function in server.R.