vscode-pull-request-azdo
vscode-pull-request-azdo copied to clipboard
Fetching Pull Requests Failed: Project Name Required
Issue Type: Bug
- Set up PAC and settings with URL and Project Name
- Try to refresh
- Error pops up and no PRs are found: "Fetching pull requests failed: A project name is required in order to reference a Git repository by name."
I have set the project name in both User and Workspace settings, but the error always says "A project name is required in order to reference a Git repository by name."
One weird thing is that the project name for my work has spaces so the URL project name is Something like "Company%20Name%20Applications." I tried both with "Company Name Applications" and with the space.
Extension version: 0.0.25 VS Code version: Code 1.61.2 (6cba118ac49a1b88332f312a8f67186f7f3c1643, 2021-10-19T14:57:20.575Z) OS version: Windows_NT x64 10.0.18363 Restricted Mode: No
System Info
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 x 2592) |
GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | undefined |
Memory (System) | 31.79GB (17.23GB free) |
Process Argv | --folder-uri file:///c%3A/Users/jmaggio/source/repos/DealerIntegration --crash-reporter-id d12ab66f-4b20-462d-8a80-2d010621308e |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30384385
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
vsccppwtct:30382698
bridge0708:30335490
pygetstartedt3:30385195
dockerwalkthru:30377721
bridge0723:30353136
pythonrunftest32:30373476
pythonf5test824:30373475
javagetstartedt:30391933
pythonvspyt187:30373474
vsqsis400:30386382
vsaa593:30376534
vssld246cf:30386378
Can you enable debug log level in settings azdoPullRequests.logLevel
and post the logs from Output tab
I am uncomfortable posting the logs as is since I am working in a work repository so I removed identifying info. Hopefully this can still be useful.
[Debug 1636063835.116s] C:\Users\jmaggio.ssh\config: ENOENT: no such file or directory, open 'C:\Users\jmaggio.ssh\config' [Debug 1636063844.413s] AzdoRepository> projectName is <format: Company Name Applications> [Debug 1636063844.413s] AzdoRepository> orgUrl is <ORG_URL> [Debug 1636063866.726s] AzdoRepository> Auth> Successful: Logged userid: <USER_ID> [Debug 1636063866.728s] Looking for git repository [Debug 1636063866.73s] Git repository found, initializing review manager and pr tree view. [Debug 1636063884.81s] Review> Validate state in progress [Debug 1636063884.811s] Review> Validating state... [Debug 1636063884.83s] FolderRepositoryManager> No remote with name 'upstream' found. All other remotes: origin [Debug 1636063884.83s] FolderRepositoryManager> Displaying configured remotes: origin, upstream [Debug 1636063885.599s] FolderRepositoryManager> Found Azdo remotes origin [Debug 1636063885.6s] AzdoRepository> Resolving Remote for remoteName: origin and gitProtocol: <REPO_URL> [Debug 1636063885.6s] AzdoRepository> Fetch metadata - enter [Debug 1636063885.601s] AzdoRepository> Searching for repos in <format: Company Name Applications> project [Debug 1636063887.055s] AzdoRepository> Found 184 repos. Searching for repo with name <repo_name format: All lowercase> [Debug 1636063887.055s] AzdoRepository> Fetch metadata <repo_name format: All lowercase> failed. No repo by that name. [Debug 1636063887.055s] AzdoRepository> Resolving Remote for remoteUrl: undefined [Debug 1636063887.632s] Review> no matching pull request metadata found for current branch <Branch Name> [Debug 1636063887.632s] AzdoRepository> Fetch pull requests for branch - enter [Debug 1636063887.632s] AzdoRepository> Fetch metadata - enter [Debug 1636063887.632s] AzdoRepository> Searching for repos in <format: Company Name Applications> project [Debug 1636063888.684s] AzdoRepository> Found 184 repos. Searching for repo with name <repo_name format: All lowercase> [Debug 1636063888.684s] AzdoRepository> Fetch metadata <repo_name format: All lowercase> failed. No repo by that name. [Debug 1636063889.441s] AzdoRepository> Fetching pull requests for search: {"sourceRefName":"<Branch Name>"} failed: Error: A project name is required in order to reference a Git repository by name.
[Debug 1636063888.684s] AzdoRepository> Found 184 repos. Searching for repo with name <repo_name format: All lowercase>
[Debug 1636063888.684s] AzdoRepository> Fetch metadata <repo_name format: All lowercase> failed. No repo by that name.
Its not able to find the repository which is open in VSCode in AzDO. Have you opened the correct repo in VSCode? Is there any special character in your repo name?
The code figures out the repo name by looking into git remote fetchUrl. You can look at this fetchUrl using command git remote -v
That's weird. The repo name is only alphabetic characters no numbers or spaces. It's two words using PascalCase. The URL found using git remote -v
has the repo name in all lower case. That is the only difference I see there. I have also tried using multiple repos and it seems to fail to find any of them even though it is seeing 184 repos in the project.
Edit: I can also confirm that following the url found using git remote -v
does send me to the repo on azure devops.
Weird, can you paste the URL in git remote -v
. You can hide the repo name if you want. I am interested in format of the URL
git remote -v
https://<companyname>@dev.azure.com/<companyname>/<company%20name%20applications>/_git/<reponame>
I think the casing is the problem. Can you create a new remote with URL containing the correct casing as it appears on AzDO portal by running git remote add vscodepr <URL_with_correct_casing>
. Then set the property in vscode settings as "azdoPullRequests.remotes": ["vscodepr"]
I was wondering if that meant something! It works! I am now able to see the PRs.
Would it be possible to make a change to get this working without manually needing to change the url? I might look into making a PR to fix that if I can figure it out later, but I've never done work on a VSCode extension before so it'd be new.
➕ 1️⃣ Issue happens for my project as well: Project name contains spaces and the actual result is an error as was described above. Will be happy to help to fix it!
@scripnichenko I have the exact same problem and hoping to get some helps. Could you share the steps you've done to address it?
@ankitbko and @scripnichenko I am running into this issue as well, the project name has spaces and is capitalized for each word
git remote -v
origin https://<name>@dev.azure.com/<name>/<Company%20Project%20Name>/_git/<reponame>
"azdoPullRequests.orgUrl": "https://<name>@dev.azure.com"
"azdoPullRequests.projectName": "Company%20Project%20Name"
I also tried "azdoPullRequests.projectName": "Company Project Name"
but neither work.
Debug:
[Debug 1684289217.007s] AzdoRepository> Fetch pull requests for branch - enter
[Debug 1684289217.007s] AzdoRepository> Fetch pull requests for branch - enter
[Debug 1684289217.007s] AzdoRepository> Fetch pull requests for branch - enter
[Debug 1684289217.007s] AzdoRepository> Fetch metadata - enter
[Debug 1684289217.007s] AzdoRepository> Fetch metadata - enter
[Debug 1684289217.007s] AzdoRepository> Fetch metadata - enter
[Debug 1684289217.008s] AzdoRepository> Searching for repos in Company%20Project%20Name project
[Debug 1684289217.008s] AzdoRepository> Searching for repos in Company%20Project%20Name project
[Debug 1684289217.008s] AzdoRepository> Searching for repos in Company%20Project%20Name project
[Debug 1684289217.659s] AzdoRepository> Found undefined repos. Searching for repo with name reponame
[Debug 1684289217.659s] AzdoRepository> Fetch metadata reponame failed. No repo by that name.
[Debug 1684289217.814s] AzdoRepository> Found undefined repos. Searching for repo with name reponame
[Debug 1684289217.815s] AzdoRepository> Fetch metadata reponame failed. No repo by that name.
[Debug 1684289217.894s] AzdoRepository> Found undefined repos. Searching for repo with name reponame
[Debug 1684289217.895s] AzdoRepository> Fetch metadata reponame failed. No repo by that name.
[Debug 1684289218.262s] AzdoRepository> Fetching pull requests for search: {"creatorId":"<extracted>","status":1} failed: Error: A project name is required in order to reference a Git repository by name.
[Debug 1684289218.437s] AzdoRepository> Fetching pull requests for search: {"status":1} failed: Error: A project name is required in order to reference a Git repository by name.
[Debug 1684289218.664s] AzdoRepository> Fetching pull requests for search: {"reviewerId":"<extracted>","status":1} failed: Error: A project name is required in order to reference a Git repository by name.
Current settings:
"azdoPullRequests.orgUrl": "https://<name>@dev.azure.com",
"azdoPullRequests.projectName": "Company%20Project%20Name",
"azdoPullRequests.telemetry.enabled": false,
"azdoPullRequests.remotes": [
"origin"
],
"azdoPullRequests.logLevel": "debug"
Finally got it to work. I had to reload the window anytime I make a change to the settings. SO testing different settings did not take until reload, but this is what ended up working:
"azdoPullRequests.orgUrl": "https://<name>@dev.azure.com"
"azdoPullRequests.projectName": "Company Project Name"
Yeah, just had this issue. Project names with spaces need to be configured unencoded it seems.
Would be nice for that to be documented in an FAQ or Known Issue or something.
We have configured our local repos using SSH instead of HTTP and the extension doesn't seem to be able to parse the URLs correctly, so adding a new remote ("vscodepr") using HTTP and setting azdoPullRequests.remotes
to ["vscodepr"]
did solve it for us - but would surely be great to also support SSH URLs in the remote.
current output of git remote -v
origin [email protected]:v3/<orgName>/<Project%20Name>/<Repo%20Name>(fetch)
origin [email protected]:v3/<orgName>/<Project%20Name>/<Repo%20Name> (push)
vscodepr https://<orgName>@dev.azure.com/<orgName>/<Project%20Name>/_git/<Repo%20Name> (fetch)
vscodepr https://<orgName>@dev.azure.com/<orgName>/<Project%20Name>/_git/<Repo%20Name> (push)