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

Error 404 on Heroku Instance when posting comments. #311

Closed
wini3d opened this issue Sep 12, 2019 · 16 comments
Closed

Error 404 on Heroku Instance when posting comments. #311

wini3d opened this issue Sep 12, 2019 · 16 comments

Comments

@wini3d
Copy link

wini3d commented Sep 12, 2019

I tried a heroku instance, the github account invite went OK! successfully, but having issues posting comments and getting a 500 error. I have already and only updated the form action to my heroku url.

  • github account access token set to admin:repo_hook checked all under it.
  • copy and pasted a generated key.pem file to key RSA_PRIVATE_KEY Heroku settings -> config vars (web/dashboard)

@VincentTam I'm using your repo with the deploy branch. Any ideas?

@VincentTam
Copy link
Contributor

VincentTam commented Sep 12, 2019

Can you post

  1. your form action URL (so that one can verify if you link is correct); and
  2. the API server's response in JSON (for debug)?

You may find such info in the any modern web browsers's Web Developer Tools → network.

sample output

Alternatively, an API client like Postman would show you the necessary info.

You can also check out my list of Staticman errors to know more about the causes of various Staticman errors.

@wini3d
Copy link
Author

wini3d commented Sep 12, 2019

Ok see below..

You can also try it on my article here. I was using your staticman3/staticmanlab server earlier on this blog and just changed the form url.

I have not included or touched any recaptcha requirement ever since I have started working with staticman as to make things simple.

stat

@wini3d
Copy link
Author

wini3d commented Sep 12, 2019

I have updated my staticman.yml and emptied the siteKey and secret and still getting 500 errors.

Never changed allowedFields ever since and it worked with the staticman3/staticmanlab

@VincentTam
Copy link
Contributor

By saying "the API server's response in JSON", I mean sth like this.

{
  "JSON": {
    "success": false,
    "rawError": {
      "message": "{\"message\":\"Not Found\",\"documentation_url\":\"https:\/\/developer.github.com\/v3\/git\/refs\/#create-a-reference\"}",
      "statusCode": 404
    },
    "errorCode": "GITHUB_CREATING_PR"
  },
  "Response payload": {
    "EDITOR_CONFIG": {
      "text": "{\"success\":false,\"rawError\":{\"message\":\"{\\\"message\\\":\\\"Not Found\\\",\\\"documentation_url\\\":\\\"https:\/\/developer.github.com\/v3\/git\/refs\/#create-a-reference\\\"}\",\"statusCode\":404},\"errorCode\":\"GITHUB_CREATING_PR\"}",
      "mode": "application\/json"
    }
  }
}

Screenshot from 2019-09-12 06-35-15

Plz consider providing a clearer screenshot by saving in PNG instead of JPG.

@wini3d
Copy link
Author

wini3d commented Sep 12, 2019

Ok got it, so it's a 404 error and we're getting the same.

Here's is my full form action Url btw

https://staticmanx.herokuapp.com/v3/entry/github/wini3d/wini3d.github.io/master/comments

@wini3d wini3d changed the title Error 500 on Heroku Instance when posting comments. Error 404 on Heroku Instance when posting comments. Sep 12, 2019
@wini3d
Copy link
Author

wini3d commented Sep 12, 2019

@VincentTam I did a fresh install with your deploy branch to this new staticmanx heroku app. Can you check out my staticman.yml and form if there's a problem there?

staticman.yml
https://github.com/wini3d/wini3d.github.io/blob/master/staticman.yml
form:
https://github.com/wini3d/wini3d.github.io/blob/master/_includes/staticman-comments.html

@VincentTam
Copy link
Contributor

Seems like this is relevant: #299 (comment). I dunno whether my merging of #231 VincentTam@f9675f9 caused the error. It's sth that I did almost a year ago. Excuse me I didn't remember that well. It seems better to pick the commit before that for branching. I'll check whether #231 is the culprit when I've got the time and motivation to do so. Always fun testing and trying.

Remarks: Things might change on GitHub's side over time, as written in #217 (comment).

@wini3d
Copy link
Author

wini3d commented Sep 12, 2019

Thanks @VincentTam , can you please link your recommended commit repo and branch directly? Sorry, getting confused with all these issue numbers.

Edit: I would assume this one with title 'Clean Up'. Is this ok?
https://github.com/VincentTam/staticman/tree/dd1969c1cd4fdecc1f159f37416d96cb4a1ad4ef

@wini3d
Copy link
Author

wini3d commented Sep 12, 2019

I'm still getting errors with the before #231 commit. :/

@VincentTam Would you mind just cloning and sharing a copy of your heroku staticman3 instance as this would be easier and since you don't recall the one that works with heroku?

@wini3d
Copy link
Author

wini3d commented Sep 12, 2019

Finally I got it working! =) Somehow, I had to give full access token (checked all) which I know is not recommended. I only checked repo:invite and admin:repo_hook before based on a tutorial post I read earlier.

Edit: found an updated one that needs to set full repo access only

Thanks again for all the help @VincentTam 👍

@wini3d wini3d closed this as completed Sep 12, 2019
@VincentTam
Copy link
Contributor

Edit: found an updated one that needs to set full repo access only

It's better to select a minimal set of priviledges due to the spam problem that I've mentioned.

Screenshot_2019-09-12 Build software better, together

@wini3d
Copy link
Author

wini3d commented Sep 12, 2019

Great thanks! Just curious @VincentTam , can you tell me exactly what read:user and user:email is for specifically with staticman usage?

@VincentTam
Copy link
Contributor

I don't remember why I checked these one year ago. They might be related to creating PR & accepting invitations.

@wini3d
Copy link
Author

wini3d commented Sep 12, 2019

I don't remember why I checked these one year ago. They might be related to creating PR & accepting invitations.

That's interesting. This is now my latest token that works.

Personal Access Tokens

When I used only the admin:repo_hook from that first v2 tutorial, I failed once with the invite then added the repo:invite which I got to work next.

With the public repo access, I'm now not sure if the repo_hook is still needed so might as well try it with another one.

In short, maybe this particular access token setup needs final confirmation so it can be properly documented just for staticman?

@VincentTam
Copy link
Contributor

I've left a comment under your linked gist: https://gist.github.com/jannispaul/3787603317fc9bbb96e99c51fe169731. @jannispaul has changed wordings to clarify the scopes.

I'm not sure if admin:repo_hook is relevant since I dunno node.js and I got Staticman's webhook working on GitHub with the legacy authentication method and v3 API without #288 and this scope.

As the name suggests, public_repo can't grant you rights to push PRs to private repos. It's up to you to decide if your bot accepts invitations to private repos.

@wini3d
Copy link
Author

wini3d commented Sep 12, 2019

As the name suggests, public_repo can't grant you rights to push PRs to private repos. It's up to you to decide if your bot accepts invitations to private repos.

Yes, I am currently on a free plan so I have set it to public only. Thanks.

I'm not sure if admin:repo_hook is relevant since I dunno node.js and I got Staticman's webhook working on GitHub with the legacy authentication method and v3 API without #288 and this scope.

I see, will try without this soon.

caiopavanelli pushed a commit to caiopavanelli/staticman that referenced this issue Aug 17, 2020
…crolled

Fully remove the avatar image when scrolling down
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