ropensci / piggyback

:package: for using large(r) data files on GitHub
https://docs.ropensci.org/piggyback
GNU General Public License v3.0
185 stars 26 forks source link

Trouble using piggyback on private repo #37

Closed moldach closed 4 years ago

moldach commented 4 years ago

I'm having trouble trying to upload files with {piggyback}.

I've created a (pre-)release .

I already have a Github token set up in my .Renviron. However, it's under GITHUB_PAT= and not GITHUB_TOKEN (not sure if this makes a difference?)

If I try to upload or create a new release I get an error:

pb_upload("data/sqlite/tfac.sqlite")
Error in a[[1]] : subscript out of bounds

traceback()

2: release_info(repo, .token)
1: pb_new_release("xia-lab/NetworkAnalystR")

I'm not sure if this is because I'm a collaborator on another users repo (e.g. using xia-lab instead of my username moldach) or for some other reason?

cboettig commented 4 years ago

Thanks for the bug report, I suspect this is due to #36, we should have a new release prepared soon.

moldach commented 4 years ago

I tried creating a fork of the repo under my username:

git clone https://github.com/moldach/NetworkAnalystR.git

And then I get a new error from pb_upload

pb_upload("data/sqlite/tfac.sqlite")
uploading data/sqlite/tfac.sqlite ...
Error in parse_url(url) : length(url) == 1 is not TRUE

traceback()

14: stop(simpleError(msg, call = if (p <- sys.parent(1L)) sys.call(p)))
13: stopifnot(length(url) == 1)
12: parse_url(url)
11: is.url(url)
10: stopifnot(is.url(url))
9: build_url(parse_url(url)[c("scheme", "hostname", "port")])
8: handle_name(url)
7: handle_find(url)
6: handle_url(handle, url, ...)
5: httr::POST(sub("\\{.+$", "", df$upload_url[[1]]), query = list(name = asset_filename(name)), 
       body = httr::upload_file(file), progress, httr::authenticate(.token, 
           "x-oauth-basic", "basic"))
4: pb_upload_file(f, repo, tag, name, overwrite, use_timestamps, 
       show_progress, .token, dir)
3: FUN(X[[i]], ...)
2: lapply(file, function(f) pb_upload_file(f, repo, tag, name, overwrite, 
       use_timestamps, show_progress, .token, dir))
1: pb_upload("data/sqlite/tfac.sqlite")
moldach commented 4 years ago

Thanks for the bug report, I suspect this is due to #36, we should have a new release prepared soon.

Not sure if the second comment I made still relates to #36 or not; I was writing it while you were responding.

Thank you

cgpu commented 4 years ago

I'm having trouble trying to upload files with {piggyback}.

I've created a (pre-)release .

I already have a Github token set up in my .Renviron. However, it's under GITHUB_PAT= and not GITHUB_TOKEN (not sure if this makes a difference?)

If I try to upload or create a new release I get an error:

pb_upload("data/sqlite/tfac.sqlite")
Error in a[[1]] : subscript out of bounds

traceback()

2: release_info(repo, .token)
1: pb_new_release("xia-lab/NetworkAnalystR")

I'm not sure if this is because I'm a collaborator on another users repo (e.g. using xia-lab instead of my username moldach) or for some other reason?

Subscribing myself in the issue to catch up with the fix once implemented, as I have experienced this as well.

Robinlovelace commented 4 years ago

Update: I've experienced this issue. It also affects repos that were created private but have since been opened, as is the case with https://github.com/Robinlovelace/od

This is what I get:

piggyback::pb_upload("od_data_df_medium.Rds")
Error in a[[1]] : subscript out of bounds
cboettig commented 4 years ago

@Robinlovelace @moldach Apologies for the slow reply, can you try:

remotes::install_github("ropensci/piggyback@patch")

and try again?

Robinlovelace commented 4 years ago

Many thanks @cboettig, I just tried installing the version as instructed and am happy to report that it worked!

cboettig commented 4 years ago

Thanks, closing now.

hoping to get a fix for the deprecation notice in #36 before sending patch to CRAN

joeytalbot commented 4 years ago

I'm still getting a similar problem when trying to upload a file.

> piggyback::pb_upload("crashes_active_london.Rds")
uploading crashes_active_london.Rds ...
Error in parse_url(url) : length(url) == 1 is not TRUE

Your patch no longer seems to be available. I tried updating to the latest version of piggyback but it didn't make any difference. Any ideas?

devtools::install_github("ropensci/piggyback")
Robinlovelace commented 4 years ago

Have you tried manually specifiying the destination repo and ensuring that it has at least 1 release already? Frustrating when it doesn't work for sure.

cgpu commented 4 years ago

I'm still getting a similar problem when trying to upload a file.

> piggyback::pb_upload("crashes_active_london.Rds")
uploading crashes_active_london.Rds ...
Error in parse_url(url) : length(url) == 1 is not TRUE

Your patch no longer seems to be available. I tried updating to the latest version of piggyback but it didn't make any difference. Any ideas?

devtools::install_github("ropensci/piggyback")

I am adding below what I currently use for fetching from private repos and works:

piggyback version:

I am using this commit for installing it and it works (the commit I think is a reference to the patch)

devtools::install_github("ropensci/piggyback@87f71e8")

GITHUB_TOKEN :

Make sure you also set your GITHUB_TOKEN in your environment, eg with:

Sys.setenv(GITHUB_TOKEN = "youractualtokenindoublequotes")

You might also have an issue with auth if you don't grant the required permissions via your GITHUB_TOKEN.

One easy solution with sensible default permissions that works with piggyback is the R:GITHUB_PAT. To create this call usethis::browse_github_pat() and you will be redirected in this link to create your token.

Hope this helps!

joeytalbot commented 4 years ago

That's working now thank you!

Skourtis commented 3 years ago

Hi,

I'm still receiving an error which stops me from using pb_new_release and pb_upload.

I'm installing devtools::install_github("ropensci/piggyback@87f71e8") after trying with the CRAN version and failing.

I've used usethis::browse_github_pat() and put the TOKEN in '.Renviron' using usethis::edit_r_environ()` in the format GITHUB_PAT=xxxyyyzzz trying with and without double quotes. or with GITHUB_TOKEN = "xxxyyyzzz".

Still I receive the error Error in releases[[1]] : subscript out of bounds to the command pb_new_release("Skourtis/multiOmics", "v1")

and this error to the command pb_track() %>% pb_upload(repo = "Skourtis/multiOmics") Warning: recursive is deprecated, please use recurse instead uploading Project_Datasets/1-s2.0-S2589004219304407-mmc2.xlsx ... Error in parse_url(url) : length(url) == 1 is not TRUE

Suggestions?

joeytalbot commented 3 years ago

The token should be listed in .Renviron as GITHUB_TOKEN=xxxxyyyyzzz without quotes.