eduardoboucas / staticman

💪 User-generated content for Git-powered websites
https://staticman.net
MIT License
2.42k stars 545 forks source link

Comment submissions throw one of two errors repeatedly. #366

Open mefrem opened 4 years ago

mefrem commented 4 years ago

Hi team! Eager to get comments working on my jekyll-themed site (with the repo here as a Github page with my own domain name).

Followed Travis Downs' guide and the comment form displays on the site, created a a bot—mefrem-bot, deployed staticman to heroku account, and now, at time of comment submissions, get one of two errors as shown below. Troubleshooting included disabling reCAPTCHA, I pored over my config files and they seem to match Downs' config as well as other staticman-enabled sites' repos' config files. Browser's console shows one of two messages when I inspect the errors.

"{""success"":false,""rawError"":{""name"":""HttpError"",""status"":404,""headers"":{""access-control-allow-origin"":""*"",""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"",""connection"":""close"",""content-encoding"":""gzip"",""content-security-policy"":""default-src""none"",""content-type"":"application/json; charset=utf-8",""date"":""Thu", 16 Jul 2020 01:25:27 GMT",""referrer-policy"":""origin-when-cross-origin", "strict-origin-when-cross-origin"",""server"":""GitHub.com"",""status"":"404 Not Found",""strict-transport-security"":"max-age=31536000; includeSubdomains; preload",""transfer-encoding"":""chunked"",""vary"":""Accept-Encoding", "Accept", "X-Requested-With"",""x-accepted-oauth-scopes"":""repo"",""x-content-type-options"":""nosniff"",""x-frame-options"":""deny"",""x-github-media-type"":"github.v3; format=json",""x-github-request-id"":"B758:6E24:67E4FE:7A6CAA:5F0FAC87",""x-oauth-scopes"":""repo"",""x-ratelimit-limit"":"60",""x-ratelimit-remaining"":"53",""x-ratelimit-reset"":"1594865880",""x-xss-protection"":"1; mode=block"},""request"":{""method"":""POST"",""url"":""https":",""headers"":{""accept"":"application/vnd.github.v3+json",""user-agent"":"Staticman octokit.js/16.35.0 Node.js/14.5.0 (Linux 4.4; x64)",""authorization"":""token"[ "REDACTED" ]",""content-type"":"application/json; charset=utf-8"},""body"":"{ "\\" "ref\":\"refs/heads/staticman_3a652d40-c703-11ea-bfce-a70bca8efac8\",\"sha\":\"fb6c6a10827ddd5a86de526414c527eb7eeab2e0\"}", "request":{ "timeout":5000, "validate":{ "owner":{ "required":true, "type":"string" }, "ref":{ "required":true, "type":"string" }, "repo":{ "required":true, "type":"string" }, "sha":{ "required":true, "type":"string" } } } }, "documentation_url":"https://developer.github.com/v3/git/refs/#create-a-reference", "_smErrorCode":"GITHUB_CREATING_PR" }, "errorCode":"GITHUB_CREATING_PR" }"\""

or

"{""success"":false,""rawError"":{""name"":""HttpError"",""status"":403,""headers"":{""access-control-allow-origin"":""*"",""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"",""connection"":""close"",""content-encoding"":""gzip"",""content-security-policy"":""default-src""none"",""content-type"":"application/json; charset=utf-8",""date"":""Thu", 16 Jul 2020 01:12:46 GMT",""referrer-policy"":""origin-when-cross-origin", "strict-origin-when-cross-origin"",""server"":""GitHub.com"",""status"":"403 Forbidden",""strict-transport-security"":"max-age=31536000; includeSubdomains; preload",""transfer-encoding"":""chunked"",""vary"":""Accept-Encoding", "Accept", "X-Requested-With"",""x-accepted-oauth-scopes"":""repo"",""x-content-type-options"":""nosniff"",""x-frame-options"":""deny"",""x-github-media-type"":"github.v3; format=json",""x-github-request-id"":"CC90:69B0:76820F:8FBD85:5F0FA98E",""x-oauth-scopes"":""repo"",""x-ratelimit-limit"":"60",""x-ratelimit-remaining"":"0",""x-ratelimit-reset"":"1594862229",""x-xss-protection"":"1; mode=block"},""request"":{""method"":""GET"",""url"":""https":",""headers"":{""accept"":"application/vnd.github.v3+json",""user-agent"":"Staticman octokit.js/16.35.0 Node.js/14.5.0 (Linux 4.4; x64)",""authorization"":""token"[ "REDACTED" ]"},""request"":{""timeout"":5000,""validate"":{""owner"":{""required"":true,""type"":""string""},""path"":{""required"":true,""type"":""string""},""ref"":{""type"":""string""},""repo"":{""required"":true,""type"":""string""}}}},""documentation_url"":""https"://developer.github.com/v3/#rate-limiting",""_smErrorCode"":""GITHUB_READING_FILE""},""errorCode"":""GITHUB_READING_FILE""}"

I have spent a while looking through old and closed issues and haven't found anything to resolve my issue with. Any help would be appreciated--thank you!

alexwaibel commented 4 years ago

Have you used the /connect endpoint yet to authenticate your Heroku instance? Is your bot listed as a collaborator on your repo?

mefrem commented 4 years ago

I had used the /connect endpoint to authentica. Bot is listed as collaborator.

Mind you, after a few days of troubleshooting, I switched to Disqus comments provider. Old commits have config files, but this issue was never resolved.

shaftoe commented 4 years ago

@mefrem nothing interesting from heroku logs ?

infominer33 commented 4 years ago

I will tell you a reason this problem can occur. I've been re-using code from project to project and hit a wall with my most recent attempt...

https://github.com/github/renaming

Github is renaming the master branch to main. This is now the default on new repositories.

while I support the change, this wreaked havoc on my most recent setup.

Even when I used tried main in my form setup, i just got 404... so I had to re-create the master branch, to make the form work... so now my submission went through, except staticman made a new branch for the entry instead of writing to master.

It seems staticman has mixed feelings about this recent change to github :D

alexwaibel commented 4 years ago

@infominer33 good catch, this is a case I guess we'll need to start handling soon since GH is now defaulting repos to 'main'.