Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extendShinyjs cannot find path in docker image can't find the #201

Closed
gadepallivs opened this issue Feb 13, 2020 · 6 comments
Closed

extendShinyjs cannot find path in docker image can't find the #201

gadepallivs opened this issue Feb 13, 2020 · 6 comments

Comments

@gadepallivs
Copy link

I am calling a custom js file using the extendShinyjs. function. The following is the snippet of the app and it works perfectly on the windows desktop. I wrapped the app in a docker image and as I launch the app to test using the command below
`sudo docker run -p 9000:9000 example_app R -e 'shiny::runApp("app.R")'
All the packages load and I get

`here starts /`
and shinyjs: error cannot find "//www/custom_script.js" file. 
library(shiny)
library(shinyjs)
library(here)
shiny::shinyApp(
  ui = shiny::fluidPage(
 shinyjs::useShinyjs(),
    tags$head(
        shinyjs::extendShinyjs(script = here::here("www", "custom_script.js")),
    ),
 shiny::selectInput(
      "region", "Region: ",
      c("The Americas", "Europe", "Middle East")
    ),
),  server = function(input, output, session) {
    shiny::observeEvent(input$region, {
      js$filterSingleValue("Region", input$region)
    })
  }
)

Is it something related to the way I am calling or docker requires some additional input ? I am using rocker/shiny image with libv8 installed
@daattali
Copy link
Owner

daattali commented Feb 14, 2020

Hmm that's definitely a bug. And I think I have a good idea of why that's happening. When I check for the file I'm only looking at the absolute path, and not taking into account the resourch paths (that are added with addResourcePath()).

That being said, I don't recommend using here::here for shiny resources, that function is great for interactive scripts, but for shiny I'd suggest being more explicit about where files live

@earnaud
Copy link

earnaud commented Jun 15, 2020

Hi,
writing in this issue since it seems to be related: I am also using a docker container to deploy a shiny app (see my MetaShARK* repos if interested in details) and some {shinjs} features such as onclick() do not work. My dev and deploy environments are slightly different (Ubuntu 19.04 in dev and 18.04 on server).

@daattali
Copy link
Owner

If you're able to provide a full reproducible example, it would make it easier for me to test/debug

@earnaud
Copy link

earnaud commented Jun 15, 2020

I won't have time soon to work on such a reprex BUT as I think this could help you, I will try as soon as possible. I think it will be a dockerized app ready to deploy. Anyway, thanks for replying :)

@daattali
Copy link
Owner

Don't worry, this sounds like a complex issue so I don't know when I'll find the time to look into it too :)

@daattali
Copy link
Owner

@gadepallivs and @earnaud : the latest version of shinyjs (not yet on CRAN, but on github) should hopefully fix this. I had to make a BREAKING CHANGE to support this, but this was a change that had to be done. Now the javascript files are being loaded the same way that any other web resource in shiny is loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants