Skip to content

Bug when adding labels to pull request #192

Closed

Description

@maclover7

Noting it here so this isn't forgotten about (currently broken on the production server). I believe this is another issue caused by the recent github version bump (something something need better test coverage). At least the labels resolved correctly?

11:40:52.491 DEBUG bot: Resolved labels: doc,vm (req_id=47558d90-8c33-11e8-8f2d-6778d538d753, pr=nodejs/node/#21911, action=pull_request.opened)
11:40:52.492 DEBUG bot: Trying to add labels: doc,vm (req_id=47558d90-8c33-11e8-8f2d-6778d538d753, pr=nodejs/node/#21911, action=pull_request.opened)
11:40:52.492 ERROR bot: Error while adding labels (req_id=47558d90-8c33-11e8-8f2d-6778d538d753, pr=nodejs/node/#21911, action=pull_request.opened)
    err: {
      "code": "400",
      "status": "Bad Request",
      "message": "Empty value for parameter 'labels': undefined"
    }

cc @Trott

Activity

  1. Trott commented on Jul 20, 2018

    @Trott
    Member

    @maclover7 I think this change will fix it. Any chance you can easily test?

    diff --git a/lib/node-repo.js b/lib/node-repo.js
    index 7d714ec..a5e362d 100644
    --- a/lib/node-repo.js
    +++ b/lib/node-repo.js
    @@ -65,7 +65,7 @@ function updatePrWithLabels (options, labels) {
         owner: options.owner,
         repo: options.repo,
         number: options.prId,
    -    body: labels
    +    labels: labels
       }, (err) => {
         if (err) {
           return options.logger.error(err, 'Error while adding labels')
  2. Trott commented on Jul 20, 2018

    @Trott
    Member

    (By the way, I think one or two of the relevant package's maintainers is on the project. @zeke for sure and I think Gregor used to be but maybe not anymore?)

  3. zeke commented on Jul 21, 2018

    @zeke
    Contributor

    The github package is deprecated as of version 13-ish as I recall. The module has been renamed to @octokit/rest and is being heroically maintained by @gr2m.

    As a first step, I would suggest swapping out the dependency in https://github.com/nodejs/github-bot/blob/master/lib/github-client.js and seeing if that fixes it.

  4. Trott commented on Jul 21, 2018

    @Trott
    Member

    As a first step, I would suggest swapping out the dependency in https://github.com/nodejs/github-bot/blob/master/lib/github-client.js and seeing if that fixes it.

    @zeke Thanks! Unfortunately, swapping out the dependency without making other changes currently breaks everything. But it might be worth looking at more closely to see how much work would be involved in fixing stuff. (It's midnight here and I'm going to bed after finishing this comment, though, so it will have to wait...) That said, a little bit of context:

    We just recently updated from the github package version 7.x to 12.x to eliminate a warning from npm audit. My goal/hope was to let this bake, fix bugs like this that are reported, write some more tests, and then upgrade to the current thing when there is slightly more test coverage.

    Before going that route, I tried to upgrade to @octokit/rest but it broke a lot more code. I took a quick look at fixing it, but decided an incremental update approach would be better, especially given our modest test coverage. That might or might not have been the wrong decision, but it seemed like the thing to do at the time.

    (You're under no obligation to help out here, of course. Just looped you in in case it was of interest or if the current issue was something you knew the fix for offhand. That said, any and all assistance is welcome!)

  5. maclover7 commented on Jul 22, 2018

    @maclover7
    ContributorAuthor

    Any chance you can easily test?

    Sadly not without editing code manually on the server. I'll open up a PR, and will merge/deploy if you approve it.

  6. added a commit that references this issue on Jul 22, 2018
  7. maclover7 commented on Jul 23, 2018

    @maclover7
    ContributorAuthor

    Looks like this has been solved, closing for now:

    12:14:41.750 DEBUG bot: Resolved labels: doc,errors (req_id=801e3480-8e93-11e8-bbb7-bdb383c2c08e, pr=nodejs/node/#21947, action=pull_request.opened)
    12:14:41.750 DEBUG bot: Trying to add labels: doc,errors (req_id=801e3480-8e93-11e8-bbb7-bdb383c2c08e, pr=nodejs/node/#21947, action=pull_request.opened)
    12:14:42.092  INFO bot: Added labels: doc,errors (req_id=801e3480-8e93-11e8-bbb7-bdb383c2c08e, pr=nodejs/node/#21947, action=pull_request.opened)
    
  8. phillipj commented on Jul 27, 2018

    @phillipj
    Member

    Chiming in here to add some thoughts.. A while back I also tried to upgrade to @octokit/rest which causes havoc for the integration tests if I remember correctly.

    I tried to wrestle those tests for some hours, and got very close, but couldn't get the last couple of tests to pass. To me it smelled like some async timing issues. For some reason I weren't able to get nock to respond currently / in time for the tests to pass.

    Thinking out loud, we might need to refactor our integration tests slightly, or possibly even replace nock if someone has better alternatives? 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions