4
votes

When I just wrote an app which runs perfectly locally, but when I tried to deploy it online, I keep getting this error:

error message:

Preparing to deploy application...DONE Uploading bundle for application: 1969928...Error in curl::curl_fetch_memory(url, handle = handle) : Timeout was reached: [api.shinyapps.io] Operation timed out after 10000 milliseconds with 0 out of 0 bytes received Calls: ... tryCatch -> tryCatchList -> tryCatchOne -> Timing stopped at: 0 0 10

my shiny version: 1.4.0.2; os: Windows10; IDE: RStudio;

Thank you very much if you can help!

My full code:

library(shiny)
library(DT)
library(readr)

######################### read data #########################
pump1 <- read_csv("data/1.csv", col_names=TRUE)
pump2 <- read_csv("data/2.csv", col_names=TRUE)
pump3 <- read_csv("data/3.csv", col_names=TRUE)
pump4 <- read_csv("data/4.csv", col_names=TRUE)
pump5 <- read_csv("data/5.csv", col_names=TRUE)
pump6 <- read_csv("data/6.csv", col_names=TRUE)
# pump7 does not have instantFlow feature
pump7 <- read_csv("data/7.csv", col_names=TRUE)

colnames(pump1) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump2) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump3) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump4) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump5) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump6) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump7) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "openDegree", "vacuumDegree")

######################### ui #########################

ui <- fluidPage(
  h1("Data Presentation", align = "center"),
  br(),
  sidebarLayout(
    sidebarPanel(
      selectInput(inputId = "data", label = "choose data to display", choices = c(
        "pump 1", "pump 2", "pump 3", "pump 4", "pump 5", "pump 6", "pump 7"
      )),
      # contents: Data summary
      h3(textOutput(outputId = "caption")),
      verbatimTextOutput(outputId = "summary"),
      width = 3
    ),
    mainPanel(
      DT::dataTableOutput(outputId = "DToutput", height = 0.5)
    )
  ),
  hr(),
  h1("roc-auc curve", align = "center"),
  br(),
  sidebarLayout(
    sidebarPanel(
      selectInput(inputId = "chooseImg", label = "choose a pump to estimate others",
                  choices = c("pump1 vs all", "pump2 vs all", "pump3 vs all", "pump4 vs all", "pump5 vs all", "pump6 vs all", "pump7 vs all"))
                ),
    mainPanel(
      imageOutput(outputId = "image")
    )
  ),
)
######################### server #########################

server <- function(input, output) {
  ############################# 1st part #############################
  # Now, data is a reactive expression,
  # when the select box changes, data changes to the spefic pump data accordingly
  data <- reactive({
    switch(input$data, 
           "pump 1" = pump1,
           "pump 2" = pump2,
           "pump 3" = pump3, 
           "pump 4" = pump4,
           "pump 5" = pump5, 
           "pump 6" = pump6, 
           "pump 7" = pump7)
    })

  output$caption <- renderText("Data summary")

  output$summary <- renderPrint({
    summary(data())
  })

  output$DToutput <- DT::renderDataTable(data())

  ############################# 2nd part #############################
  # toDisplay <- switch(
  #   input$chooseImg,
  #   "pump1 vs all" = list(src = "images/roc_1vsall.png"),
  #   "pump2 vs all" = list(src = "images/roc_2vsall.png"),
  #   "pump3 vs all" = list(src = "images/roc_3vsall.png"),
  #   "pump4 vs all" = list(src = "images/roc_4vsall.png"),
  #   "pump5 vs all" = list(src = "images/roc_5vsall.png"),
  #   "pump6 vs all" = list(src = "images/roc_6vsall.png"),
  #   "pump7 vs all" = list(src = "images/roc_7vsall.png")
  # )

  output$image <- renderImage({
    if (is.null(input$chooseImg))
      return(NULL)

    if (input$chooseImg == "pump1 vs all")
      return(list(src = "images/roc_1vsall.png"))

    else if (input$chooseImg == "pump2 vs all")
      return(list(src = "images/roc_2vsall.png"))

    else if (input$chooseImg == "pump3 vs all")
      return(list(src = "images/roc_3vsall.png"))

    else if (input$chooseImg == "pump4 vs all")
      return(list(src = "images/roc_4vsall.png"))

    else if (input$chooseImg == "pump5 vs all")
      return(list(src = "images/roc_5vsall.png"))

    else if (input$chooseImg == "pump6 vs all")
      return(list(src = "images/roc_6vsall.png"))

    else if (input$chooseImg == "pump7 vs all")
      return(list(src = "images/roc_7vsall.png"))
  }, deleteFile = FALSE)

}

shinyApp(ui, server)
1
p.s: I used the blue button besides the "Run App" to publish the app, on the "Publish to Server" page, I choose app.R, data(the folder), and images(the folder)Stanley_Chen

1 Answers

0
votes

try to delete rsconnect folder and install from the beginning I had this problem with my project once the steps I have done is :

  • delete rsconnect folder from the project folder
  • reinstall the app from the beginning using the publish button in RStudio