【问题标题】:Pins board_s3 in Shiny app: Works locally but not remotely在 Shiny 应用程序中固定 board_s3:在本地工作,但不能在远程工作
【发布时间】: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 文件时出现问题),但这也无济于事。

【问题讨论】:

    标签: r amazon-s3 shiny pins


    【解决方案1】:

    我意识到我可以访问shinyapps.io 支持,经过一番反复,我们发现了这个问题:部署应用程序时,{{paws.storage}} 包没有包含在捆绑包中。您必须在代码中手动包含library(paws.storage),然后一切正常!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多