pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.24k stars 124 forks source link

Error `gh: Field 'projectItems' doesn't exist on type 'PullRequest'` when viewing/editing PRs #513

Open d3caf opened 3 months ago

d3caf commented 3 months ago

Issue Description

Type: bug report

Describe what happened (or what feature you want)

When running Octo pr list or Octo pr edit <number>, I get the following error message: gh: Field 'projectItems' doesn't exist on type 'PullRequest'. The PR buffer is then blank and I can't do anything with the PR. This also occurs when calling Octo pr list and occurs again each time I arrow-key between the PRs in the list.

Describe what you expected to happen

PR data to be visible in the PR edit buffer and no errors to be thrown

How to reproduce it (as minimally and precisely as possible)

  1. Call Octo pr list or Octo pr edit <number>

Tell us your environment

Versions

Anything else we need to know?

It worked briefly when I first installed/configured it, but then seemingly has stopped.

pwntester commented 3 months ago

Please try setting default_to_projects_v2 = false in the configuration. Seems like you are using projects v2 which may be causing this problem

d3caf commented 3 months ago

@pwntester hmm... I'm using Lazy and this is my config:

  {
    "pwntester/octo.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "nvim-telescope/telescope.nvim",
      "nvim-tree/nvim-web-devicons",
    },
    cmd = "Octo",
    config = function()
      require("octo").setup({
        default_to_projects_v2 = false,
      })
    end,
  },

Still getting the same error with that option set.

pwntester commented 3 months ago

Im a bit puzzled on this one. The error you are receiving is from gh so it is the GitHub backend the one saying that this property does not exist on the PullRequest object. Are you using GitHub Enterprise? If thats the case, your GHES version may be old and not support projects v2. Anyway, this PR should fix the issue. Let me know if it works for you

d3caf commented 3 months ago

@pwntester thank you! Yeah, the project is in GHE. I'm actually noticing that it may be an issue with gh itself and how it handles auth? e.g. if I do gh pr checkout 123 in a GHE project, it requests auth via 1password. After I've authenticated through 1p, the command just hangs indefinitely until I ctrl+c it. Then if I run it again, it runs as expected (since I'm authenticated already).

I'll give that PR a shot!