octo.nvim icon indicating copy to clipboard operation
octo.nvim copied to clipboard

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

Open d3caf opened this issue 1 year ago • 4 comments

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

  • gh: 2.45.0
  • octo.nvim: master@1e2376a
  • nvim: 0.9.5
  • MacOS: 14.3.1

Anything else we need to know?

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

d3caf avatar Mar 12 '24 16:03 d3caf

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

pwntester avatar Mar 12 '24 21:03 pwntester

@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.

d3caf avatar Mar 14 '24 16:03 d3caf

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

pwntester avatar Mar 18 '24 08:03 pwntester

@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!

d3caf avatar Mar 19 '24 17:03 d3caf