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

Need new method of creating orphan gh-pages branch in use_github_pages() #1472

Closed
mikeroswell opened this issue Aug 11, 2021 · 3 comments
Closed

Comments

@mikeroswell
Copy link

Hi,

And thanks for your support, as I've already received some help on this issue. I was told that the 500 errors were on the github side and likely intermittent but have been getting them now every time I try for a week, wondering if you know what I might do. Not sure how to make this reproducible but system info and error messages copied below:

R.Version()
$platform
[1] "x86_64-apple-darwin17.0"

$arch
[1] "x86_64"

$os
[1] "darwin17.0"

$system
[1] "x86_64, darwin17.0"

$status
[1] ""

$major
[1] "4"

$minor
[1] "1.0"

$year
[1] "2021"

$month
[1] "05"

$day
[1] "18"

$`svn rev`
[1] "80317"

$language
[1] "R"

$version.string
[1] "R version 4.1.0 (2021-05-18)"

$nickname
[1] "Camp Pontanezen"

> usethis::use_pkgdown_github_pages()
• Record your site's url in the pkgdown config file (optional, but recommended)
• Modify '_pkgdown.yml'
✓ Initializing empty, orphan 'gh-pages' branch in GitHub repo 'mikeroswell/MeanRarity'
Error in gh_process_response(raw) : 
GitHub API error (500): 
Message: 
Type .Last.error.trace to see where the error occurred
> .Last.error.trace
$calls
$calls[[1]]
usethis::use_pkgdown_github_pages()

$calls[[2]]
use_github_pages()

$calls[[3]]
create_gh_pages_branch(tr, branch = "gh-pages")

$calls[[4]]
gh("POST /repos/{owner}/{repo}/git/commits", message = "first commit", 
    tree = sha_empty_tree)

$calls[[5]]
gh::gh(endpoint, ..., owner = tr$repo_owner, repo = tr$repo_name, 
    .api_url = tr$api_url)

$calls[[6]]
gh_process_response(raw)

$calls[[7]]
gh_error(response)

$calls[[8]]
throw(cond)


$parents
[1] 0 1 2 3 4 5 6 7

$envs
$envs[[1]]
[1] "0x7fb8bdbf85c8"

$envs[[2]]
[1] "0x7fb8b92ee440"

$envs[[3]]
[1] "0x7fb8bec5c9c8"

$envs[[4]]
[1] "0x7fb8bd3e4d90"

$envs[[5]]
[1] "0x7fb8bd3e85a0"

$envs[[6]]
[1] "0x7fb8bd7664e0"

$envs[[7]]
[1] "0x7fb8bd765750"

$envs[[8]]
[1] "0x7fb8bd783120"


$topenvs
$topenvs[[1]]
[1] "namespace:usethis"

$topenvs[[2]]
[1] "namespace:usethis"

$topenvs[[3]]
[1] "namespace:usethis"

$topenvs[[4]]
[1] "namespace:usethis"

$topenvs[[5]]
[1] "namespace:gh"

$topenvs[[6]]
[1] "namespace:gh"

$topenvs[[7]]
[1] "namespace:gh"

$topenvs[[8]]
[1] "0x7fb8bec01298"


$indices
[1] 1 2 3 4 5 6 7 8

$nframes
[1] 8

$messages
$messages[[1]]
[1] "\nGitHub API error (500): \nMessage: "


$ignore
NULL

$classes
[1] "github_error"   "http_error_500" "error"          "condition"     

$pids
[1] 24611 24611 24611 24611 24611 24611 24611 24611

attr(,"class")
[1] "rlib_trace"
@jennybc
Copy link
Member

jennybc commented Aug 18, 2021

I was able to replicate your experience and dug into it. I eventually got desperate enough to emulate the key bits of what we're doing via gh with just with curl and also could not succeed. For my own notes, the first command silently fails, then second says that this commit is not found.

curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  -H "Authorization: token ghp_XXX" \
  https://api.github.com/repos/jennybc/abcd/git/commits \
  -d '{"message":"from curl","tree":"4b825dc642cb6eb9a060e54bf8d69288fbee4904"}'
  
curl \
  -H "Accept: application/vnd.github.v3+json" \
  -H "Authorization: token ghp_XXX" \
  https://api.github.com/repos/jennybc/abcd/git/commits/4b825dc642cb6eb9a060e54bf8d69288fbee4904

It appears that it is no longer possible to create a commit of the empty tree via the GitHub API and it's returning an extremely unhelpful 500 error. Here's an example of someone else who has also recently made this unpleasant discovery.

action-badges/core#4 (comment)

So usethis:::create_gh_pages_branch() (which is where the error is occurring) or, at a higher level, use_github_pages(), is going to have to adopt some new method creating an orphan gh-pages branch if one does not already exist.

@jennybc jennybc changed the title persistent github server issue with use_pkgdown_github_pages() Need new method of creating orphan gh-pages branch in use_github_pages() Aug 18, 2021
@mikeroswell
Copy link
Author

Hi jennybc,
I got the email saying you had closed this issue so I re-installed usethis and tried again; not obvious to me that the error message has changed and still not working for me. Thanks!

R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> devtools::install_github("r-lib/usethis")
Downloading GitHub repo r-lib/usethis@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                       
2: CRAN packages only        
3: None                      
4: R6 (2.5.0 -> 2.5.1) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 1
R6 (2.5.0 -> 2.5.1) [CRAN]
Installing 1 packages: R6
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.1/R6_2.5.1.tgz'
Content type 'application/x-gzip' length 82529 bytes (80 KB)
==================================================
downloaded 80 KB


The downloaded binary packages are in
	/var/folders/xz/pn001xk93nv73w0fyz7p0lz00000gp/T//Rtmp1ojrzh/downloaded_packages
✓  checking for file ‘/private/var/folders/xz/pn001xk93nv73w0fyz7p0lz00000gp/T/Rtmp1ojrzh/remotesd8d44a0e6491/r-lib-usethis-5256ee8/DESCRIPTION’ ...
─  preparing ‘usethis’:
✓  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Removed empty directory ‘usethis/vignettes’
   Omitted ‘LazyData’ from DESCRIPTION
─  building ‘usethis_2.0.1.9000.tar.gz’
   
* installing *source* package ‘usethis’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (usethis)
> usethis::use_pkgdown_github_pages()
✓ Setting active project to '/Rstudio_Git/MeanRarity'
• Record your site's url in the pkgdown config file (optional, but recommended)
• Modify '_pkgdown.yml'
✓ Initializing empty, orphan 'gh-pages' branch in GitHub repo 'mikeroswell/MeanRarity'
Error in gh_process_response(raw) : 
GitHub API error (500): 
Message: 
Type .Last.error.trace to see where the error occurred
> .Last.error.trace
$calls
$calls[[1]]
usethis::use_pkgdown_github_pages()

$calls[[2]]
use_github_pages()

$calls[[3]]
create_gh_pages_branch(tr, branch = "gh-pages")

$calls[[4]]
gh("POST /repos/{owner}/{repo}/git/commits", message = "first commit", 
    tree = sha_empty_tree)

$calls[[5]]
gh::gh(endpoint, ..., owner = tr$repo_owner, repo = tr$repo_name, 
    .api_url = tr$api_url)

$calls[[6]]
gh_process_response(raw)

$calls[[7]]
gh_error(response)

$calls[[8]]
throw(cond)


$parents
[1] 0 1 2 3 4 5 6 7

$envs
$envs[[1]]
[1] "0x7fd1f43d32d8"

$envs[[2]]
[1] "0x7fd1f2dd6270"

$envs[[3]]
[1] "0x7fd1f3be7b98"

$envs[[4]]
[1] "0x7fd1f40cf3f0"

$envs[[5]]
[1] "0x7fd1f40cecf0"

$envs[[6]]
[1] "0x7fd1f3cdd658"

$envs[[7]]
[1] "0x7fd1f3cdc890"

$envs[[8]]
[1] "0x7fd1f3d0f930"


$topenvs
$topenvs[[1]]
[1] "namespace:usethis"

$topenvs[[2]]
[1] "namespace:usethis"

$topenvs[[3]]
[1] "namespace:usethis"

$topenvs[[4]]
[1] "namespace:usethis"

$topenvs[[5]]
[1] "namespace:gh"

$topenvs[[6]]
[1] "namespace:gh"

$topenvs[[7]]
[1] "namespace:gh"

$topenvs[[8]]
[1] "0x7fd1f2da2350"


$indices
[1] 1 2 3 4 5 6 7 8

$nframes
[1] 8

$messages
$messages[[1]]
[1] "\nGitHub API error (500): \nMessage: "


$ignore
NULL

$classes
[1] "github_error"   "http_error_500" "error"          "condition"     

$pids
[1] 55508 55508 55508 55508 55508 55508 55508 55508

attr(,"class")
[1] "rlib_trace"
> usethis::use_github_pages()
✓ Initializing empty, orphan 'gh-pages' branch in GitHub repo 'mikeroswell/MeanRarity'
Error in gh_process_response(raw) : 
GitHub API error (500): 
Message: 
Type .Last.error.trace to see where the error occurred
> .Last.error.trace
$calls
$calls[[1]]
usethis::use_github_pages()

$calls[[2]]
create_gh_pages_branch(tr, branch = "gh-pages")

$calls[[3]]
gh("POST /repos/{owner}/{repo}/git/commits", message = "first commit", 
    tree = sha_empty_tree)

$calls[[4]]
gh::gh(endpoint, ..., owner = tr$repo_owner, repo = tr$repo_name, 
    .api_url = tr$api_url)

$calls[[5]]
gh_process_response(raw)

$calls[[6]]
gh_error(response)

$calls[[7]]
throw(cond)


$parents
[1] 0 1 2 3 4 5 6

$envs
$envs[[1]]
[1] "0x7fd1f0a47428"

$envs[[2]]
[1] "0x7fd1f1e53758"

$envs[[3]]
[1] "0x7fd1f2c34e40"

$envs[[4]]
[1] "0x7fd1f2c346d0"

$envs[[5]]
[1] "0x7fd1f2e21390"

$envs[[6]]
[1] "0x7fd1f2e24468"

$envs[[7]]
[1] "0x7fd1f2e4cf20"


$topenvs
$topenvs[[1]]
[1] "namespace:usethis"

$topenvs[[2]]
[1] "namespace:usethis"

$topenvs[[3]]
[1] "namespace:usethis"

$topenvs[[4]]
[1] "namespace:gh"

$topenvs[[5]]
[1] "namespace:gh"

$topenvs[[6]]
[1] "namespace:gh"

$topenvs[[7]]
[1] "0x7fd1f2da2350"


$indices
[1] 1 2 3 4 5 6 7

$nframes
[1] 7

$messages
$messages[[1]]
[1] "\nGitHub API error (500): \nMessage: "


$ignore
NULL

$classes
[1] "github_error"   "http_error_500" "error"          "condition"     

$pids
[1] 55508 55508 55508 55508 55508 55508 55508

attr(,"class")
[1] "rlib_trace"
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.1.0     pillar_1.6.2       prettyunits_1.1.1  remotes_2.4.0     
 [5] tools_4.1.0        sys_3.4            testthat_3.0.4     pkgbuild_1.2.0    
 [9] pkgload_1.2.1      jsonlite_1.7.2     memoise_2.0.0      lifecycle_1.0.0   
[13] tibble_3.1.3       pkgconfig_2.0.3    rlang_0.4.11       cli_3.0.1         
[17] rstudioapi_0.13    curl_4.3.2         pkgdown_1.6.1      fastmap_1.1.0     
[21] httr_1.4.2         withr_2.4.2        gitcreds_0.1.1     desc_1.3.0        
[25] fs_1.5.0           vctrs_0.3.8        askpass_1.1        devtools_2.4.2    
[29] rprojroot_2.0.2    gert_1.3.2         glue_1.4.2         R6_2.5.1          
[33] gh_1.3.0           processx_3.5.2     fansi_0.5.0        sessioninfo_1.1.1 
[37] callr_3.7.0        purrr_0.3.4        magrittr_2.0.1     ps_1.6.0          
[41] credentials_1.3.1  ellipsis_0.3.2     usethis_2.0.1.9000 utf8_1.2.2        
[45] openssl_1.4.4      cachem_1.0.5       crayon_1.4.1   

@jennybc
Copy link
Member

jennybc commented Aug 25, 2021

Please restart R, after having installed the current dev version of usethis, and try again.

I have used it successfully:

https://github.com/jennybc/abcd
jennybc/abcd@69c9df4
https://jennybc.github.io/abcd/

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

No branches or pull requests

2 participants