【发布时间】:2022-11-05 08:35:38
【问题描述】:
我正在尝试使用 pin 包来访问部署在 shinyapps.io 上的 Shiny 应用程序的数据。引脚板位于 Amazon S3 存储桶中。在本地,一切正常。但是当我部署应用程序时,我收到“应用程序无法启动。退出状态 1”错误。日志不是很有帮助:
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)
我对出了什么问题没有很好的理论——也许 Shinyapps.io 阻止了与 S3 的连接?我尝试明确提供 S3 密钥(以防访问 .Renviron 文件时出现问题),但这也无济于事。
【问题讨论】: