vscode-pull-request-github icon indicating copy to clipboard operation
vscode-pull-request-github copied to clipboard

[regression in 0.64] Cannot read properties of undefined (reading 'toLowerCase')

Open janakjjp opened this issue 3 years ago • 20 comments

  • Extension version: v0.64.0
  • VSCode Version: 1.78.1
  • OS: macOS 13.3.1 (a)

Steps to Reproduce:

  1. Go to review someone else's PR: open GitHub Pull Requests, expand a PR
  2. Click on the Description entry

Expected behavior:

  • The description appears.

Actual behavior:

  • The tab opens, stuck on "Loading..." and the above error appears
  • I can review files, just not the description.

Note this is a regression in this version; downgrading to v0.62.0 resolves the issue.

janakjjp avatar May 10 '23 15:05 janakjjp

I'm not able to reproduce this. Are you using GitHub Enterprise? And if so, what version is it?

alexr00 avatar May 12 '23 15:05 alexr00

Yes, this is GitHub Enterprise, v3.7.0. I've temporarily downgraded to 0.62, but I can upgrade back up to 0.64.

Is there additional logging I can capture for you? Maybe I should grab a stacktrace if I can?

janakjjp avatar May 12 '23 18:05 janakjjp

I have some more debugging data for you. It appears to be an issue parsing the reviewers list.

  • If there are no reviewers, it loads fine.
  • If there is one non-team reviewer, it loads fine.
  • If there are two reviewers and the second one is a team, the first reviewer shows, but the second reviewer is blank.
  • If there are two reviewers and the first one is a team, it errors.
  • Most other PRs (>3 reviewers, any mix of individuals or teams) always seems to error out.

janakjjp avatar May 12 '23 21:05 janakjjp

Great info, thank you!

alexr00 avatar May 16 '23 10:05 alexr00

I'm still having trouble reproducing this issue. Can you repro the issue then share the output from GitHub Pull Request and GitHub Enterprise Authentication?

alexr00 avatar May 16 '23 12:05 alexr00

Happy to do so, can you explain how I should share the output?

(It occurs to me that I could probably try and debug the issue in the extension myself, just haven't had time to dig into how to do it)

janakjjp avatar May 18 '23 15:05 janakjjp

OK, figured out how to grab output, but I don't think it's particularly interesting to the error.

GitHub Enterprise Authentication

2023-05-19 08:54:53.339 [info] Reading sessions from keychain...
2023-05-19 08:54:53.340 [info] Getting sessions for all scopes...
2023-05-19 08:54:53.340 [info] Got stored sessions!
2023-05-19 08:54:53.340 [info] Got 2 verified sessions.
2023-05-19 08:54:53.340 [info] Got 2 sessions for ...
2023-05-19 08:54:59.711 [info] Getting sessions for read:org,read:user,repo,user:email,workflow...
2023-05-19 08:54:59.711 [info] Got 1 sessions for read:org,read:user,repo,user:email,workflow...

GitHub Pull Request

2023-05-19 08:54:59.979 [info] Looking for git repository
2023-05-19 08:54:59.980 [info] Found 0 repositories during activation
2023-05-19 08:54:59.980 [info] Git repository found, initializing review manager and pr tree view.
2023-05-19 08:54:59.993 [info] Registering git provider
2023-05-19 08:54:59.993 [info] Review> Validate state in progress
2023-05-19 08:54:59.993 [info] Review> Validating state...
2023-05-19 08:54:59.993 [info] Cannot updates repositories as git is uninitialized
2023-05-19 08:54:59.993 [info] Review> Validate state in progress
2023-05-19 08:54:59.993 [info] Review> Validating state...
2023-05-19 08:54:59.993 [info] Cannot updates repositories as git is uninitialized
2023-05-19 08:54:59.993 [info] Review> Validate state in progress
2023-05-19 08:54:59.993 [info] Review> Validating state...
2023-05-19 08:54:59.993 [info] Cannot updates repositories as git is uninitialized
2023-05-19 08:54:59.993 [info] Review> Validate state in progress
2023-05-19 08:54:59.993 [info] Review> Validating state...
2023-05-19 08:54:59.994 [info] Cannot updates repositories as git is uninitialized
2023-05-19 08:54:59.994 [info] Review> Validate state in progress
2023-05-19 08:54:59.994 [info] Review> Validating state...
2023-05-19 08:54:59.994 [info] Cannot updates repositories as git is uninitialized
2023-05-19 08:54:59.996 [info] Review> Branch master is ignored in ignoredPullRequestBranches.
2023-05-19 08:54:59.996 [info] Review> Branch master is ignored in ignoredPullRequestBranches.
2023-05-19 08:55:00.379 [info] Review> Branch master is ignored in ignoredPullRequestBranches.
2023-05-19 08:55:00.379 [info] Review> Branch master is ignored in ignoredPullRequestBranches.
2023-05-19 08:55:00.379 [info] Review> Branch master is ignored in ignoredPullRequestBranches.
2023-05-19 08:55:02.850 [info] Git initialization state changed: state=initialized
2023-05-19 08:55:02.850 [info] Review> Validate state in progress
2023-05-19 08:55:02.850 [info] Review> Validating state...
2023-05-19 08:55:02.851 [info] Review> Validate state in progress
2023-05-19 08:55:02.851 [info] Review> Validating state...
2023-05-19 08:55:02.853 [info] Review> Validate state in progress
2023-05-19 08:55:02.853 [info] Review> Validating state...
2023-05-19 08:55:02.853 [info] Review> Validate state in progress
2023-05-19 08:55:02.853 [info] Review> Validating state...
2023-05-19 08:55:02.856 [info] Review> Validate state in progress
2023-05-19 08:55:02.856 [info] Review> Validating state...
2023-05-19 08:55:02.860 [info] Found GitHub remote for folder /Users/jparekh/plaid/wadsworth-server
2023-05-19 08:55:03.220 [info] Found GitHub remote for folder /Users/jparekh/plaid/go.git
2023-05-19 08:55:03.379 [info] Found GitHub remote for folder /Users/jparekh/plaid/batch
2023-05-19 08:55:03.387 [info] Found GitHub remote for folder /Users/jparekh/plaid/infra
2023-05-19 08:55:03.399 [info] Found GitHub remote for folder /Users/jparekh/plaid/docs
2023-05-19 08:55:03.772 [info] Repo state for file:///Users/jparekh/plaid/go.git changed.
2023-05-19 08:55:03.772 [info] Repo file:///Users/jparekh/plaid/go.git has already been setup.
2023-05-19 08:55:04.206 [info] Review> Branch master is ignored in ignoredPullRequestBranches.
2023-05-19 08:55:04.724 [info] Review> Branch master is ignored in ignoredPullRequestBranches.
2023-05-19 08:55:04.749 [info] Review> Branch master is ignored in ignoredPullRequestBranches.
2023-05-19 08:55:04.756 [info] Review> Branch master is ignored in ignoredPullRequestBranches.
2023-05-19 08:55:04.763 [info] Review> Branch master is ignored in ignoredPullRequestBranches.
2023-05-19 08:55:55.408 [info] Repo state for file:///Users/jparekh/plaid/batch changed.
2023-05-19 08:55:55.409 [info] Repo file:///Users/jparekh/plaid/batch has already been setup.
2023-05-19 08:55:56.056 [info] Repo state for file:///Users/jparekh/plaid/docs changed.
2023-05-19 08:55:56.056 [info] Repo file:///Users/jparekh/plaid/docs has already been setup.
2023-05-19 08:55:56.299 [info] Repo state for file:///Users/jparekh/plaid/infra changed.
2023-05-19 08:55:56.299 [info] Repo file:///Users/jparekh/plaid/infra has already been setup.
2023-05-19 08:55:57.113 [info] Repo state for file:///Users/jparekh/plaid/wadsworth-server changed.
2023-05-19 08:55:57.113 [info] Repo file:///Users/jparekh/plaid/wadsworth-server has already been setup.
2023-05-19 08:56:06.101 [info] Review> Validate state in progress
2023-05-19 08:56:06.102 [info] Review> Validating state...
2023-05-19 08:56:06.111 [info] Found GitHub remote for folder /Users/jparekh/plaid/go.git
2023-05-19 08:56:06.164 [info] Review> Branch master is ignored in ignoredPullRequestBranches.

(I think I triggered the error two minutes later or so, no time-specific logs for that.)

I suspect I need to download the uncompiled extension and debug it and see if I can see the stacktrace / inputs?

janakjjp avatar May 19 '23 16:05 janakjjp

Thanks @janakjjp. I wanted to confirm that we were using GitHub Enterpise auth correctly and that we were getting the right scopes, and the log you provided does indicate that.

Next time you see the error can you open the developer tools (command: Developer: Toggle Developer Tools) and copy the full error from the console?

alexr00 avatar May 22 '23 10:05 alexr00

Yep, although it's... brief:

Cannot read properties of undefined (reading 'toLowerCase')
c @ workbench.desktop.main.js:754

Let me know if you need me to load a deobfuscated version of the extension to debug further, or anything else!

janakjjp avatar May 25 '23 17:05 janakjjp

OK, I prettified the source and have a little more for you:

Cannot read properties of undefined (reading 'toLowerCase')
c @ workbench.desktop.main.js:formatted:166491
(anonymous) @ workbench.desktop.main.js:formatted:166487
invoke @ workbench.desktop.main.js:formatted:26070
deliver @ workbench.desktop.main.js:formatted:26166
fire @ workbench.desktop.main.js:formatted:26136
addNotification @ workbench.desktop.main.js:formatted:168887
notify @ workbench.desktop.main.js:formatted:276218
(anonymous) @ workbench.desktop.main.js:formatted:252821
d @ workbench.desktop.main.js:formatted:252799
$showMessage @ workbench.desktop.main.js:formatted:252796
N @ workbench.desktop.main.js:formatted:256103
M @ workbench.desktop.main.js:formatted:256089
H @ workbench.desktop.main.js:formatted:256039
G @ workbench.desktop.main.js:formatted:255962
(anonymous) @ workbench.desktop.main.js:formatted:255888
invoke @ workbench.desktop.main.js:formatted:26070
deliver @ workbench.desktop.main.js:formatted:26166
fire @ workbench.desktop.main.js:formatted:26136
fire @ workbench.desktop.main.js:formatted:53974
q.onmessage @ workbench.desktop.main.js:formatted:275028

The offending line is

C.item.severity === D.Severity.Error && (C.item.message.original instanceof Error ? console.error(C.item.message.original) : console.error((0, R.toErrorMessage)(C.item.message.linkedText.toString(), !0))))

No lowerCase there, I assume it's deep in the call stack 🤔

janakjjp avatar May 25 '23 17:05 janakjjp

Thanks @janakjjp! Unfortunately the error is occurring in another process and we're not getting a good stack track :(

I've taken a close look at the team reviewer code I added last month and found a place that might be causing the problem. I'm only guessing, but maybe your Enterprise instance isn't returning team reviewers with the properties that we expect/require. I'm making a change for this guess. It will be available in the pre-release build (can be tested with VS Code insiders) on Monday.

alexr00 avatar May 26 '23 13:05 alexr00

Gave this a shot—it's not erroring out anymore, and is mirroring the behavior of 0.62. So, this seems to be a reasonable fix!

One side bug: the team reviewers are not being shown in the UI at all. For example, compare the web:

image

with the nightly extension:

image

However, this is not a new regression, this was also the case with 0.62. Let me know if I should file an issue about this, or this is WaI given the "properties" you require and if I should go chasing down how to provide those bits.

janakjjp avatar May 31 '23 17:05 janakjjp

Aha, saw the PR description, team names. Looks like we don't use them as widely... and that it's OK with GH. Maybe consider if one can use the identifier (whatever it's called) instead so you can show it in the pane and mirror the web experience?

janakjjp avatar May 31 '23 17:05 janakjjp

@janakjjp thanks for trying this out!

Aha, saw the PR description, team names. Looks like we don't use them as widely... and that it's OK with GH. Maybe consider if one can use the identifier (whatever it's called) instead so you can show it in the pane and mirror the web experience?

This is very good to know. Based on the GitHub docs there will always be a team name, but I can definitely fall back to another value if it doesn't exist.

alexr00 avatar Jun 01 '23 09:06 alexr00

I wonder if the team "identifier" vs. the descriptive name is ambiguously referred to in GH, and that's the source of the confusion? I'm just a regular engineer though, don't know enough about GH specs. :)

janakjjp avatar Jun 01 '23 13:06 janakjjp

@janakjjp can you give the pre-release version of the GitHub extension a try and let us know if this is fixed for you?

TylerLeonhardt avatar Jun 28 '23 22:06 TylerLeonhardt

I can confirm this was fixed as of the last public release. Do you want me to test it again with the latest prerelease, or is that sufficient?

Thanks for following up!

janakjjp avatar Jun 28 '23 22:06 janakjjp

The team usually verifies issues with the prerelease version of an extension on VS Code Insiders when a prerelease version is available. However, I noticed that v0.66.1 came out after #4885 was merged, which is likely why the issue showed up as fixed on the stable version of the extension.

@janakjjp Could you test it again with the latest prerelease please, in case a recent regression showed up?

rzhao271 avatar Jun 28 '23 23:06 rzhao271

This was already verified in https://github.com/microsoft/vscode-pull-request-github/issues/4817#issuecomment-1570603339. Thank you @janakjjp !

alexr00 avatar Jun 29 '23 08:06 alexr00

I still see this issue with the latest windows x64 desktop downloaded as of 8-16-2023! I tried an older version of github desktop (from 2021) and no issues

a2ruan avatar Aug 16 '23 15:08 a2ruan