Cannot Enable Github Pages via API: Blank 500 Error

Hello, I’m starting to get blank 500 “Internal Server Error” responses when I try to enable Github Pages through the API. This used to work a couple days ago.

Request URL: https://api.github.com/repos/hodgef/my-new-site-2/pages
Request Method: POST
Status Code: 500 Internal Server Error

The weird thing is that the response is blank so I have no clue what’s causing it.

I would appreciate any help, thanks!

It seems this issue can also be reproduced via postman, please help

https://docs.github.com/en/rest/reference/repos#create-a-github-pages-site

:wave: hello there @hodgef and welcome to the GitHub Support Community!

We appreciate the report––that 500 Internal Server Error is not expected behavior. I surfaced this in our logs, but I also noticed that neither hodgef/my-site-test nor hodgef/my-new-site-2 exist as public repositories under your account. If these are private repositories, could you try enabling GitHub Pages via the API again and sharing the full output of a curl -v request that indicates the same error? If they no longer exist, could you try reproducing this on a public repository and see if that helps?

I facing the same problem. I enabled the repository to public view.

curl -v --location --request POST 'https://api.github.com/repos/betosg/amppage.com.br/pages' \
--header 'Accept: application/vnd.github.switcheroo-preview+json' \
--header 'Authorization: Basic  XXXXXXXXXXXXXXXXXXX' \
--header 'Content-Type: text/plain' \
--data-raw '{
    "source": {
        "branch": "master",
        "path": "/"
  }
}'
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 54.207.47.76:443...
* TCP_NODELAY set
* Connected to api.github.com (54.207.47.76) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=*.github.com
*  start date: Jun 22 00:00:00 2020 GMT
*  expire date: Aug 17 12:00:00 2022 GMT
*  subjectAltName: host "api.github.com" matched cert's "*.github.com"
*  issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
*  SSL certificate verify ok.
> POST /repos/betosg/amppage.com.br/pages HTTP/1.1
> Host: api.github.com
> User-Agent: curl/7.68.0
> Accept: application/vnd.github.switcheroo-preview+json
> Authorization: Basic XXXXXXXXXXXXXXXXXXX
> Content-Type: text/plain
> Content-Length: 71
> 
* upload completely sent off: 71 out of 71 bytes
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 Internal Server Error
< Date: Mon, 27 Jul 2020 20:17:28 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 0
< Server: GitHub.com
< Status: 500 Internal Server Error
< X-RateLimit-Limit: 5000
< X-RateLimit-Remaining: 4991
< X-RateLimit-Reset: 1595883308
< X-GitHub-Media-Type: github.switcheroo-preview; format=json
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset
< Access-Control-Allow-Origin: *
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< X-Frame-Options: deny
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Content-Security-Policy: default-src 'none'
< Vary: Accept-Encoding, Accept, X-Requested-With
< X-GitHub-Request-Id: B096:4C68:B5AE79:101BD58:5F1F3658
< 
* Connection #0 to host api.github.com left intact
1 Like

Hello @francisfuzz , I just tried this with a new public repo. Here’s my curl -v output, same as Beto:

curl -v --location --request POST 'https://api.github.com/repos/hodgef/my-test-site-3/pages' --header 'Accept: applicat
ion/vnd.github.switcheroo-preview+json' --header 'Authorization: Basic XXX' --header 'Content-Type: text/p
lain' --data-raw '{
    "source": {
        "branch": "master",
        "path": "/"
  }
}'
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 140.82.112.5...
* TCP_NODELAY set
* Connected to api.github.com (140.82.112.5) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=*.github.com
*  start date: Jun 22 00:00:00 2020 GMT
*  expire date: Aug 17 12:00:00 2022 GMT
*  subjectAltName: host "api.github.com" matched cert's "*.github.com"
*  issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
*  SSL certificate verify ok.
> POST /repos/hodgef/my-test-site-3/pages HTTP/1.1
> Host: api.github.com
> User-Agent: curl/7.58.0
> Accept: application/vnd.github.switcheroo-preview+json
> Authorization: Basic XXX
> Content-Type: text/plain
> Content-Length: 71
>
* upload completely sent off: 71 out of 71 bytes
< HTTP/1.1 500 Internal Server Error
< Server: GitHub.com
< Date: Mon, 27 Jul 2020 20:34:22 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 0
< Status: 500 Internal Server Error
< X-RateLimit-Limit: 5000
< X-RateLimit-Remaining: 4994
< X-RateLimit-Reset: 1595885368
< X-OAuth-Scopes: repo
< X-Accepted-OAuth-Scopes:
< X-OAuth-Client-Id: 548a6e02e01ae9015446
< X-GitHub-Media-Type: github.switcheroo-preview; format=json
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset
< Access-Control-Allow-Origin: *
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< X-Frame-Options: deny
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Content-Security-Policy: default-src 'none'
< Vary: Accept-Encoding, Accept, X-Requested-With
< X-GitHub-Request-Id: D657:5FD9:26AF47C:4255A90:5F1F3A4E
<
* Connection #0 to host api.github.com left intact

Thanks for looking into this, I hope it’s fixable :slight_smile:

1 Like

@betosg & @hodgef - Thank you so much for sharing these example curl -v requests with us. That’s extremely helpful for engineers to check out.

As a next step, we’ve escalated this to our engineering team and while we don’t have a timeline for when this will be resolved, we will follow up here when we have an update from them. :bowing_man:

2 Likes

Hello :wave:!

Pages team here. We just deployed a fix that should address this issue. Let us know if you still see 500 errors on POST.

Sorry for the inconvenience. We are preparing some upcoming changes for Pages and we let this regression slipped.

3 Likes

It works! Thank you @yoannchaudet & team for fixing this so quickly.

1 Like