Reputation: 89
I'm trying to use the pins package to access data for a Shiny app deployed on shinyapps.io. The pins board lives in an Amazon S3 bucket. Locally, everything works. But when I deploy the app, I get an "The application failed to start. exit status 1" error. The logs aren't very helpful:
2022-10-19T15:19:22.316043+00:00 shinyapps[6862336]: Error in value[[3L]](cond) :
2022-10-19T15:19:22.316075+00:00 shinyapps[6862336]: Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
2022-10-19T15:19:22.316080+00:00 shinyapps[6862336]: Execution halted
2022-10-19T15:19:22.316096+00:00 shinyapps[6862336]: Shiny application exiting ...
MWE:
library(pins)
board <- board_s3("vzpins",
region = "us-east-1",
access_key = Sys.getenv("S3_ACCESS_KEY"),
secret_access_key = Sys.getenv("S3_SECRET_ACCESS_KEY"))
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
# Run the application
shinyApp(ui = ui, server = server)
I don't have a good theory of what's wrong -- maybe shinyapps.io is blocking the connection to S3? I tried providing the S3 keys explicitly (in case it's a problem with accessing the .Renviron file) but that didn't help either.
Upvotes: 0
Views: 131
Reputation: 89
I realized that I have access to shinyapps.io support, and after some back and forth we identified the issue: When deploying the app, the {{paws.storage}} package does not get included in the bundle. You have to manually include library(paws.storage)
in the code, and then everything works!
Upvotes: 0