6

I'm trying to deploy a shiny app to the shinyapps.io server, but keep getting an error relating to a custom-built package that is hosted in a private github repo owned by our organization (note that I have replaced the actual name of the package, company name, and private repo name in the error below):

error: Building package: [PACKAGE NAME]
################################ Begin Task Log 
################################ 
################################# End Task Log 
################################# 
Error: Unhandled Exception: Child Task 530176316 failed: Error building 
image: Error fetching [PACKAGE NAME] (1.0.2) source. Error accessing GitHub 
repository ORGANIZATION/PRIVATE_REPO. HTTP 404: Not Found

I know the repo link is good, because installing via devtools::install_github("ORGANIZATION/PRIVATE_REPO, auth_token = token works. I'm an admin for the organization page, and also made sure that token has both repo and admin:org scope.

I've also made sure to tick "Private Repository Access" in my shinyapps.io account page as stated here.

Anyone have any thoughts on what I might be doing wrong??

Thanks!

ab-bpm
  • 61
  • 3
  • 1
    Are you sure that you have authorized shinyapps.io to use your github profile? See Account > Profile > Scroll down to connect with github. – Brandon Bertelsen Oct 03 '18 at 23:56

3 Answers3

5

Create an .Rprofile file in your project folder that you would intend to deploy.

You would need to set that repo options in the .Rprofile. and add your private github link. Something like

# A sample .Rprofile file with two different package repositories.
local({
  r <- getOption("repos")
  r["CRAN"] <- "https://cran.rstudio.com/"
  r["mycompany"] <- "http://rpackages.mycompany.com/"
  options(repos = r)
})

This is well explained here. Package management in RStudio Connect.

Rappster
  • 12,762
  • 7
  • 71
  • 120
user5249203
  • 4,436
  • 1
  • 19
  • 45
2

It is necessary to enable private access to the repo in the shinyapps.io dashboard as shown here

private github repo shinyapps

But you also need to give the proper permissions to the organization from github -> settings -> applications

github applicatons settings

Select shinyapps from the applications list

select shinyapps application

And then grant access to the specific organization

grant org access

And you are done! rsconnect will automatically detect the source of the repo, provided it as installed with the auth_token parameter using devtools::install_github

jpmarindiaz
  • 1,599
  • 1
  • 13
  • 21
1

Just in case, I found the above answer to allow for specific corporate repositories, not installing from a private github repo. For that, this link has this to say:

Go to Account >> Profile, then under github LINK the accounts, and allow private repo access.

Amit Kohli
  • 2,860
  • 2
  • 24
  • 44