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

Failed to create .httr-oauth #84

Closed
andyjp94 opened this issue Sep 17, 2017 · 8 comments
Closed

Failed to create .httr-oauth #84

andyjp94 opened this issue Sep 17, 2017 · 8 comments
Labels

Comments

@andyjp94
Copy link

I am running shiny in a docker image and am getting the following error

Warning: Error in : Failed to create local cache ('.httr-oauth')
Stack trace (innermost first):
    101: <Anonymous>
    100: stop
     99: user_info
     98: <reactive:isRegUser> [/srv/shiny-server/shinyproteome/server.R#70]
     87: isRegUser
     86: eval
     85: eval
     84: inherits
     83: isTruthy
     82: fun_
     81: dotloop
     80: req
     79: renderUI [/srv/shiny-server/shinyproteome/server.R#531]
     78: func
     77: origRenderFunc
     76: output$tabpanelcontents
      1: runApp

The user_info function is as follows

# This calls a Shiny module that creates on authentication token ("auth") and the login button.
  auth <- callModule(googleAuth, "loginButton")
  
  user_info <- reactive({
    # Returns the user info that Google has about the logged-in email address.
    # Args:
    #   None
    # Returns:
    #   A Google "People resource" (a data structure with various information about the user)
    req(auth())
    with_shiny(get_user_info,
               shiny_access_token = auth())
  })

I'm guessing its a file permissions issue but I can't seem to find where its trying to write to. Any pointers would be fantastic :)

@MarkEdmondson1234
Copy link
Owner

Hmm could I see the file structure of your Docker container? e.g. where do you put the shiny app? Do you run it through googleComputeEngineR? If not, at the very least you can see what works there: https://cloudyr.github.io/googleComputeEngineR/articles/shiny-app.html

@andyjp94
Copy link
Author

This is my Dockerfile, I modified it so it looks pretty much the same as the one shown here in the link you sent.

FROM rocker/shiny
MAINTAINER Mark Edmondson ([email protected])

# install R package dependencies
RUN apt-get update && apt-get install -y \
    gawk \
    libsasl2-dev \
    libssh2-1-dev \
    libssl-dev \
    mongodb-clients \
    ## clean up
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/ \
    && rm -rf /tmp/downloaded_packages/ /tmp/*.rds

## Install packages from CRAN
RUN install2.r --error \
    -r 'http://cran.rstudio.com' \
    data.table \
    devtools\
    dplyr \
    DT \
    ggplot2 \
    mongolite \
    plotrix \
    plyr \
    shiny\
    && R -e "source('http://bioconductor.org/biocLite.R');\
             biocLite('limma');\
             devtools::install_github(c('MarkEdmondson1234/googleID', 'MarkEdmondson1234/googleAuthR'));"\
    && rm -rf /tmp/downloaded_packages/ /tmp/*.rds\
    && sed -i -e 's/site_dir.*$/app_dir \/srv\/shiny-server\/shinyproteome;/g' /etc/shiny-server/shiny-server.conf \
    && gawk -i inplace '/run_as shiny;/ { print; print "  preserve_logs true;"; next }1' /etc/shiny-server/shiny-server.conf

## assume shiny app is in build folder /shiny
COPY ./shiny/ /srv/shiny-server/shinyproteome

The log file is here:
shinyproteome-shiny-20170924-132539-42287.log where the user_info function referenced in it is included in my previous message.

@andyjp94
Copy link
Author

andyjp94 commented Oct 3, 2017

I fixed the issue by making an empty file in the shiny directory called .httr-oauth. Could you let me know if you think this is a problem with googleAuthR or with shiny please.

@MarkEdmondson1234
Copy link
Owner

That confirms a file permissions issue as we suspected, which I guess is unique to where you are deploying it since it works ok on VMs, shinyapps.io etc. I can't replicate it so its difficult to track down where the problem is.

The actual writing of the .httr-oauth token is done by httr, it would be worth just checking what versions you have of all packages and make sure updated.

@MarkEdmondson1234
Copy link
Owner

Ahhh, is it possible this issue with httr 1.3.0 ? #81

@MarkEdmondson1234
Copy link
Owner

I replicated this today in a Kubernetes container. Thanks for the fix above! It shouldn't be making that .httr-oauth file though, as its not needed, so now I have working example will look to see if that can be stopped.

@MarkEdmondson1234
Copy link
Owner

I think getOption("httr_oauth_cache") needs to be FALSE so that is what this commit will do.

@MarkEdmondson1234
Copy link
Owner

This should be sorted now

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

No branches or pull requests

2 participants