MarkEdmondson1234 / googleAuthR

Google API Client Library for R. Easy authentication and help to build Google API R libraries with OAuth2. Shiny compatible.
https://code.markedmondson.me/googleAuthR
Other
175 stars 54 forks source link

An error has occurred Unable to connect to worker after 60.00 seconds; startup took too long #211

Closed aarathybabu97 closed 3 years ago

aarathybabu97 commented 3 years ago

I have been working on a shiny app that uses a google login which works perfect locally but as soon as I deploy it on shinyapps.io I get the error : An error has occurred Unable to connect to worker after 60.00 seconds; startup took too long. I have provided a sample code below, kindly look through it as I am unable to figure out what is wrong

Steps to reproduce the problem


library(shiny)
library(shinydashboard)
library(DT)
library(shinyWidgets)
library(shinyjs)
library(googlesheets4)
library(tidyverse)
library(googleAuthR)

options(googleAuthR.scopes.selected = c(
  "https://www.googleapis.com/auth/userinfo.email",
  "https://www.googleapis.com/auth/userinfo.profile"
))

options("googleAuthR.webapp.client_id" = "xxxxxxx")
options("googleAuthR.webapp.client_secret" = "xxxxxxxxxx")

get_email <- function() {
  f <- gar_api_generator(
    "https://openidconnect.googleapis.com/v1/userinfo",
    "POST",
    data_parse_function = function(x) x$email,
    checkTrailingSlash = FALSE
  )
  f()
}

ui <- navbarPage(
  title = "App Name",
  windowTitle = "Browser window title",
  tabPanel("Tab 1",
           useShinyjs(),
           sidebarLayout(
             sidebarPanel(
               p("Welcome!"),

               textOutput("display_username"),

               googleAuthUI("gauth_login")
             ),
             mainPanel(
              p("jabba")
             )
           )
  ),
  tabPanel("Tab 2",
           p("Layout for tab 2")
  )
)

server <- function(input, output, session) {

accessToken <- callModule(googleAuth, "gauth_login",
                            login_text = "Sign in via Google",
                            logout_text = "Sign Out",
                            login_class = "btn btn-success",
                            logout_class = "btn btn-success"
  )
  userDetails <- reactive({
    validate(
      need(accessToken(), "")
    )

    with_shiny(get_email, shiny_access_token = accessToken())
  })
  output$display_username <-
    renderText({
    if (is.null(accessToken()) == FALSE) {
      validate(
        need(userDetails(), ""))
      paste0("  ", userDetails())
  }
 })
}
runApp(list(ui = ui, server = server))

Session Info

current session info ```r - Session info -------------------------------------------------------------- setting value version R version 4.1.0 (2021-05-18) os Windows 10 x64 system x86_64, mingw32 ui RStudio language (EN) collate English_India.1252 ctype English_India.1252 tz Australia/Sydney date 2021-08-21 - Packages ------------------------------------------------------------------ package * version date lib askpass 1.1 2019-01-13 [1] assertthat 0.2.1 2019-03-21 [1] backports 1.2.1 2020-12-09 [1] broom 0.7.9 2021-07-27 [1] bslib 0.2.5.1 2021-05-18 [1] cachem 1.0.5 2021-05-15 [1] cellranger 1.1.0 2016-07-27 [1] cli 3.0.1 2021-07-17 [1] clipr 0.7.1 2020-10-08 [1] colorspace 2.0-2 2021-06-24 [1] crayon 1.4.1 2021-02-08 [1] crosstalk 1.1.1 2021-01-12 [1] curl 4.3.2 2021-06-23 [1] DBI 1.1.1 2021-01-15 [1] dbplyr 2.1.1 2021-04-06 [1] desc 1.3.0 2021-03-05 [1] details 0.2.1 2020-01-12 [1] digest 0.6.27 2020-10-24 [1] dplyr * 1.0.7 2021-06-18 [1] DT * 0.18 2021-04-14 [1] ellipsis 0.3.2 2021-04-29 [1] fansi 0.5.0 2021-05-25 [1] fastmap 1.1.0 2021-01-25 [1] forcats * 0.5.1 2021-01-27 [1] fs 1.5.0 2020-07-31 [1] gargle 1.2.0 2021-07-02 [1] generics 0.1.0 2020-10-31 [1] ggplot2 * 3.3.5 2021-06-25 [1] glue 1.4.2 2020-08-27 [1] googleAuthR * 1.4.0 2021-04-02 [1] googledrive 2.0.0 2021-07-08 [1] googlesheets4 * 1.0.0.9000 2021-07-31 [1] gtable 0.3.0 2019-03-25 [1] haven 2.4.1 2021-04-23 [1] hms 1.1.0 2021-05-17 [1] htmltools 0.5.1.1 2021-01-22 [1] htmlwidgets 1.5.3 2020-12-10 [1] httpuv 1.6.1 2021-05-07 [1] httr 1.4.2 2020-07-20 [1] jquerylib 0.1.4 2021-04-26 [1] jsonlite 1.7.2 2020-12-09 [1] knitr 1.33 2021-04-24 [1] later 1.2.0 2021-04-23 [1] lifecycle 1.0.0 2021-02-15 [1] lubridate 1.7.10 2021-02-26 [1] magrittr 2.0.1 2020-11-17 [1] memoise 2.0.0 2021-01-26 [1] mime 0.11 2021-06-23 [1] modelr 0.1.8 2020-05-19 [1] munsell 0.5.0 2018-06-12 [1] openssl 1.4.4 2021-04-30 [1] pillar 1.6.2 2021-07-29 [1] pkgconfig 2.0.3 2019-09-22 [1] png 0.1-7 2013-12-03 [1] promises 1.2.0.1 2021-02-11 [1] purrr * 0.3.4 2020-04-17 [1] R6 2.5.0 2020-10-28 [1] Rcpp 1.0.7 2021-07-07 [1] readr * 2.0.0 2021-07-20 [1] readxl 1.3.1 2019-03-13 [1] reprex 2.0.0 2021-04-02 [1] rlang 0.4.11 2021-04-30 [1] rprojroot 2.0.2 2020-11-15 [1] rsconnect 0.8.18 2021-05-24 [1] rstudioapi 0.13 2020-11-12 [1] rvest 1.0.1 2021-07-26 [1] sass 0.4.0 2021-05-12 [1] scales 1.1.1 2020-05-11 [1] sessioninfo 1.1.1 2018-11-05 [1] shiny * 1.6.0 2021-01-25 [1] shinydashboard * 0.7.1 2018-10-17 [1] shinyjs * 2.0.0 2020-09-09 [1] shinyWidgets * 0.6.0 2021-03-15 [1] stringi 1.7.3 2021-07-16 [1] stringr * 1.4.0 2019-02-10 [1] tibble * 3.1.3 2021-07-23 [1] tidyr * 1.1.3 2021-03-03 [1] tidyselect 1.1.1 2021-04-30 [1] tidyverse * 1.3.1 2021-04-15 [1] tzdb 0.1.2 2021-07-20 [1] utf8 1.2.2 2021-07-24 [1] vctrs 0.3.8 2021-04-29 [1] withr 2.4.2 2021-04-18 [1] xfun 0.24 2021-06-15 [1] xml2 1.3.2 2020-04-23 [1] xtable 1.8-4 2019-04-21 [1] yaml 2.2.1 2020-02-01 [1] source CRAN (R 4.0.2) CRAN (R 4.0.2) CRAN (R 4.0.3) CRAN (R 4.1.0) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.2) CRAN (R 4.0.5) CRAN (R 4.0.2) CRAN (R 4.0.5) CRAN (R 4.0.3) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.0.4) CRAN (R 4.0.2) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.0.4) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.3) CRAN (R 4.0.3) CRAN (R 4.0.2) CRAN (R 4.0.5) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.1.0) CRAN (R 4.0.5) CRAN (R 4.0.5) Github (tidyverse/googlesheets4@33b3df8) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.3) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.0.2) CRAN (R 4.0.5) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.4) CRAN (R 4.0.4) CRAN (R 4.1.0) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.0.3) CRAN (R 4.0.2) CRAN (R 4.0.5) CRAN (R 4.1.0) CRAN (R 4.0.2) CRAN (R 4.0.0) CRAN (R 4.0.3) CRAN (R 4.0.2) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.0.3) CRAN (R 4.1.0) CRAN (R 4.0.5) CRAN (R 4.0.2) CRAN (R 4.0.2) CRAN (R 4.0.3) CRAN (R 4.0.3) CRAN (R 4.0.5) CRAN (R 4.0.4) CRAN (R 4.1.0) CRAN (R 4.1.0) CRAN (R 4.0.5) CRAN (R 4.0.4) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.5) CRAN (R 4.0.2) CRAN (R 4.0.2) CRAN (R 4.0.2) ```


MarkEdmondson1234 commented 3 years ago

Could be a few things, can you see the logs in shinyapps console? My guess is a library not included or an auth file not included in the upload.

aarathybabu97 commented 3 years ago

Thank you. Could you tell me more about the auth file, because I haven't included anything except the code Ive posted above. The shinyapps logs are as below

2021-08-21T09:11:25.875633+00:00 shinyapps[4518154]: 3: Setting LC_TIME failed, using "C" 
2021-08-21T09:11:25.875634+00:00 shinyapps[4518154]: 5: Setting LC_MONETARY failed, using "C" 
2021-08-21T09:11:25.916259+00:00 shinyapps[4518154]: RJSONIO version: (none)
2021-08-21T09:11:26.115162+00:00 shinyapps[4518154]: Using jsonlite for JSON processing
2021-08-21T09:11:25.916256+00:00 shinyapps[4518154]: LANG: en_USs.UTF-8ss
2021-08-21T09:11:25.916257+00:00 shinyapps[4518154]: shiny version: 1.6.0
2021-08-21T09:11:25.916257+00:00 shinyapps[4518154]: R version: 4.1.0
2021-08-21T09:11:25.916259+00:00 shinyapps[4518154]: rmarkdown version: 2.9
2021-08-21T09:11:25.916259+00:00 shinyapps[4518154]: knitr version: 1.33
2021-08-21T09:11:25.916258+00:00 shinyapps[4518154]: httpuv version: 1.6.1
2021-08-21T09:11:25.916361+00:00 shinyapps[4518154]: Using pandoc: /opt/connect/ext/pandoc/2.11
2021-08-21T09:11:26.118808+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.146910+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.146911+00:00 shinyapps[4518154]: Attaching package: 'shinydashboard'
2021-08-21T09:11:26.146912+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.147651+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.163817+00:00 shinyapps[4518154]: Attaching package: 'DT'
2021-08-21T09:11:26.147650+00:00 shinyapps[4518154]: The following object is masked from 'package:graphics':
2021-08-21T09:11:26.164867+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.147651+00:00 shinyapps[4518154]:     box
2021-08-21T09:11:26.147652+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.164868+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.163816+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.163818+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.164865+00:00 shinyapps[4518154]: The following objects are masked from 'package:shiny':
2021-08-21T09:11:26.232642+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.232908+00:00 shinyapps[4518154]: The following object is masked from 'package:shinyWidgets':
2021-08-21T09:11:26.164868+00:00 shinyapps[4518154]:     dataTableOutput, renderDataTable
2021-08-21T09:11:26.232645+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.232909+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.232644+00:00 shinyapps[4518154]: Attaching package: 'shinyjs'
2021-08-21T09:11:26.232909+00:00 shinyapps[4518154]:     alert
2021-08-21T09:11:26.233140+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.233141+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.233139+00:00 shinyapps[4518154]: The following object is masked from 'package:shiny':
2021-08-21T09:11:26.233141+00:00 shinyapps[4518154]:     runExample
2021-08-21T09:11:26.233367+00:00 shinyapps[4518154]: The following objects are masked from 'package:methods':
2021-08-21T09:11:26.232910+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.233368+00:00 shinyapps[4518154]:     removeClass, show
2021-08-21T09:11:26.233368+00:00 shinyapps[4518154]: 
2021-08-21T09:11:26.233369+00:00 shinyapps[4518154]: 
2021-08-21T09:11:27.274305+00:00 shinyapps[4518154]: -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
2021-08-21T09:11:27.280526+00:00 shinyapps[4518154]: v ggplot2 3.3.5     v purrr   0.3.4
2021-08-21T09:11:27.280527+00:00 shinyapps[4518154]: v tidyr   1.1.3     v stringr 1.4.0
2021-08-21T09:11:27.280528+00:00 shinyapps[4518154]: v readr   2.0.0     v forcats 0.5.1
2021-08-21T09:11:27.361874+00:00 shinyapps[4518154]: x dplyr::filter() masks stats::filter()
2021-08-21T09:11:27.361873+00:00 shinyapps[4518154]: -- Conflicts ------------------------------------------ tidyverse_conflicts() --
2021-08-21T09:11:27.361875+00:00 shinyapps[4518154]: x dplyr::lag()    masks stats::lag()
2021-08-21T09:11:27.280527+00:00 shinyapps[4518154]: v tibble  3.1.3     v dplyr   1.0.7
2021-08-21T09:11:27.659894+00:00 shinyapps[4518154]: 
2021-08-21T09:11:27.659896+00:00 shinyapps[4518154]: Listening on http://127.0.0.1:6305
aarathybabu97 commented 3 years ago

Hi Mark, It was some problem with the runApp() function., used shinyApp() instead

Thank you

MarkEdmondson1234 commented 3 years ago

Glad it got sorted!