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

422 - Validation Failed #149

Closed
gingerlime opened this issue Apr 20, 2016 · 14 comments
Closed

422 - Validation Failed #149

gingerlime opened this issue Apr 20, 2016 · 14 comments
Assignees
Labels

Comments

@gingerlime
Copy link

Pronto looks awesome. I'd love to use it, but am hitting a small problem trying to push comments to github.

Here's my yml:

all:
  exclude:
    - 'spec/**/*'
github:
  slug: gingerlime/my-private-repo
  # access_token: B26354
  api_endpoint: https://api.github.com/
  web_endpoint: https://github.com/
max_warnings: 150
verbose: true

I'm running

GITHUB_ACCESS_TOKEN=*** pronto run -f github_pr -c origin/master

And it's showing these errors (across several files):

Running Pronto::Rubocop
Creating pull request comment on 1
Failed to post: [17a30b6181c4678efccdcbd1514b052560ab9c3e] app/controllers/articles_controller.rb:21 - Align the elements of a hash literal if they span more than one line. with POST https://ap
i.github.com/repos/gingerlime/my-private-repo/pulls/1/comments: 422 - Validation Failed
Error summary:
  resource: PullRequestReviewComment
  code: invalid
  field: path // See: https://developer.github.com/v3/pulls/comments/#create-a-comment
Creating pull request comment on 1
Failed to post: [17a30b6181c4678efccdcbd1514b052560ab9c3e] app/controllers/articles_controller.rb:88 - Avoid using `rescue` in its modifier form. with POST https://api.github.com/repos/gingerli
me/my-private-repo/pulls/1/comments: 422 - Validation Failed
Error summary:
  resource: PullRequestReviewComment
  code: invalid
  field: path // See: https://developer.github.com/v3/pulls/comments/#create-a-comment
Creating pull request comment on 1
Failed to post: [17a30b6181c4678efccdcbd1514b052560ab9c3e] app/controllers/articles_controller.rb:89 - Avoid using `rescue` in its modifier form. with POST https://api.github.com/repos/gingerli
me/my-private-repo/pulls/1/comments: 422 - Validation Failed
...

Any clue why it's returning this error? I think the token is set up correctly, but maybe I missed something.

@steverob
Copy link

Same here. THere were couple of comments that were successfully created though.

@steverob
Copy link

One thing I noticed was that this happened whenever pronto was trying to comment on lines that were not part of the diff of the PR in question.

Probably pronto is scanning the entire files that are under the changed list? @gingerlime

@doomspork
Copy link
Member

@gingerlime @steverob are you making sure you set the PULL_REQUEST_ID ENV that the github_pr reporter relies on? Without it (or if you state the wrong PR ID) you will get a similar error.

@gingerlime
Copy link
Author

@doomspork It's been a while, so I don't remember to be honest, but looking at the README, and CHANGELOG it seems like this parameter is optional(?)

@steverob
Copy link

steverob commented Aug 3, 2016

@doomspork yep, it happened even though the PULL_REQUEST_ID was set. Like I said, it keeps trying to comment on lines that are not even part of the PR's diff. Is that something that should not be happening by design?

@doomspork
Copy link
Member

I was just spit balling @steverob because I had gotten a similar issue when I omitted the PR ID. @steverob is your error identical to @gingerlime's? Could you paste it?

@jglapa
Copy link

jglapa commented Aug 15, 2016

I'm experiencing the exact same problem. Initially I though it was the #170 but looking closer at the error message it's actually the path invalid validation error.

I'm running pronto only with eslint-runner the PULL_REQUEST_ID is always provided, text and json formatter seem to provide everything that's needed:

web-app/js/angular/directives/ContainerDimensionsDirective.js:1 W: Parsing error: The keyword 'import' is reserved
{"level":"W","message":"Parsing error: The keyword 'import' is reserved","path":"web-app/js/angular/directives/ContainerDimensionsDirective.js","line":1,"commit_sha":"14bb0ce361f3ecbdeaadef2da92d0bc98512503d","runner":"Pronto::ESLint"},

@mpluta-airhelp
Copy link

mpluta-airhelp commented Aug 19, 2016

Hello!
Same problem here:
screen shot 2016-08-19 at 09 38 20

and result in GH:
screen shot 2016-08-19 at 09 41 04

No comments were posted though. Running pronto 0.7.
I actually have another case where the error message is the same but messages are posted correctly.

@mmozuras mmozuras self-assigned this Aug 20, 2016
@mmozuras mmozuras added the bug label Aug 20, 2016
@mmozuras
Copy link
Member

Fixed and released v0.7.1.
Thanks everyone for reporting it! 🙇

@jglapa
Copy link

jglapa commented Aug 30, 2016

Hey @mmozuras I'm still experiencing the problem! But only sometimes. I'm using 0.7.1
I've run the analysis with github_pr and json formatters and that's what I got. Is it possible that those underscores in the path are problematic? Is there a way to turn on debugging of those HTTP Requests?

Failed to post: POST https://api.github.com/repos/foo/bar/pulls/4482/comments: 422 - Validation Failed
Error summary:
  resource: PullRequestReviewComment
  code: invalid
  field: path // See: https://developer.github.com/v3/pulls/comments/#create-a-comment
[{"level":"W","message":"'Map' is defined but never used.","path":"web-app/js/modules/ReduxApp/workers/__tests__/highlightedCells.spec.js","line":1,"commit_sha":"acfd3d91a4a9ea6f18fbf8d7fc7aa36b099819e9","runner":"Pronto::ESLintNpm"},
{"level":"W","message":"'List' is defined but never used.","path":"web-app/js/modules/ReduxApp/workers/__tests__/highlightedCells.spec.js","line":1,"commit_sha":"acfd3d91a4a9ea6f18fbf8d7fc7aa36b099819e9","runner":"Pronto::ESLintNpm"},
{"level":"W","message":"'times' is defined but never used.","path":"web-app/js/modules/ReduxApp/workers/__tests__/highlightedCells.spec.js","line":2,"commit_sha":"acfd3d91a4a9ea6f18fbf8d7fc7aa36b099819e9","runner":"Pronto::ESLintNpm"},
{"level":"W","message":"'random' is defined but never used.","path":"web-app/js/modules/ReduxApp/workers/__tests__/highlightedCells.spec.js","line":2,"commit_sha":"acfd3d91a4a9ea6f18fbf8d7fc7aa36b099819e9","runner":"Pronto::ESLintNpm"},
{"level":"W","message":"'faker' is defined but never used.","path":"web-app/js/modules/ReduxApp/workers/__tests__/highlightedCells.spec.js","line":3,"commit_sha":"acfd3d91a4a9ea6f18fbf8d7fc7aa36b099819e9","runner":"Pronto::ESLintNpm"},
{"level":"W","message":"'highlightedCells' is defined but never used.","path":"web-app/js/modules/ReduxApp/workers/__tests__/highlightedCells.spec.js","line":4,"commit_sha":"24312bf5f615ead7fa8f045ef984e3b48a7a07eb","runner":"Pronto::ESLintNpm"}]
6 Pronto messages posted to GitHub

@mmozuras mmozuras reopened this Aug 30, 2016
@mmozuras
Copy link
Member

@jglapa you can set verbose to true in configuration. It might not be enough. You might want to try adding additional logging via bundle open pronto. submit_comments method in PullRequestFormatter could use them.

@jglapa
Copy link

jglapa commented Aug 30, 2016

@mmozuras after digging a bit in the problem. I came to the following conclusion:
My patch that was analyzed in this case by pronto-eslint_npm runner was analyzing too much! It wanted to report an issue on a file that was never changed in the given PR. Github doesn't allow to post comments for files that are not in the scope of a PR so I was getting the error: 'path invalid'
This makes sense.

From my perspective you can close this issue again since it's clearly a misconfiguration of my ci server that was checking out the wrong branch. Thanks for a quick response!.

@mmozuras
Copy link
Member

@jglapa thanks for taking the time to write down the problem. It might be useful for others in the future 😄

@agibralter
Copy link

Is #259 related to the issues people were running into?

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

No branches or pull requests

7 participants