Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate-boards throws NullReferenceException #1251

Closed
dw-alexangas opened this issue Jun 19, 2024 · 6 comments · May be fixed by #1256
Closed

integrate-boards throws NullReferenceException #1251

dw-alexangas opened this issue Jun 19, 2024 · 6 comments · May be fixed by #1256
Labels
bug Something isn't working

Comments

@dw-alexangas
Copy link

dw-alexangas commented Jun 19, 2024

Description

Running the command:

gh ado2gh integrate-boards --ado-org "ORGNAME" --ado-team-project "Project Name" --github-org "_GitHub Org Name_" --github-repo "_GitHub Repo Name_"

Fails with:

[2024-06-19 13:40:59] [INFO] Integrating Azure Boards...
[2024-06-19 13:40:59] [DEBUG] HTTP GET: https://dev.azure.com/ORGNAME/_apis/projects/Project%20Name?api-version=5.0-preview.1
[2024-06-19 13:40:59] [DEBUG] RESPONSE (OK): {"id":"GUID","name":"Project Name","description":"","url":"https://dev.azure.com/ORGNAME/_apis/projects/GUID","collection":{"id":"GUID","name":"ORGNAME","url":"https://dev.azure.com/ORGNAME/_apis/projectCollections/GUID","collectionUrl":"https://dev.azure.com/ORGNAME/"},"state":"wellFormed","defaultTeam":{"id":"GUID","name":"Team Name","url":"https://dev.azure.com/ORGNAME/_apis/projects/GUID/teams/GUID"},"revision":493,"capabilities":{"processTemplate":{"templateName":"Basic","templateTypeId":"b8a3a935-7e91-48b8-a94c-606d37c3e9f2"},"versioncontrol":{"sourceControlType":"Git","gitEnabled":"True","tfvcEnabled":"False"}},"visibility":"private","lastUpdateTime":"0001-01-01T00:00:00"}
[2024-06-19 13:40:59] [DEBUG] HTTP POST: https://dev.azure.com/ORGNAME/_apis/Contribution/HierarchyQuery?api-version=5.0-preview.1
[2024-06-19 13:41:00] [DEBUG] HTTP BODY: {"contributionIds":["ms.vss-work-web.github-user-data-provider"],"dataProviderContext":{"properties":{"accessToken":"***","sourcePage":{"routeValues":{"project":"Project Name"}}}}}
[2024-06-19 13:41:00] [DEBUG] RESPONSE (OK): {"dataProviderSharedData":{},"dataProviders":{"ms.vss-web.component-data":{},"ms.vss-web.shared-data":null}}
[2024-06-19 13:41:00] [ERROR] System.NullReferenceException: Object reference not set to an instance of an object.
   at OctoshiftCLI.Services.AdoApi.GetGithubHandle(String org, String teamProject, String githubToken)
   at OctoshiftCLI.AdoToGithub.Commands.IntegrateBoards.IntegrateBoardsCommandHandler.Handle(IntegrateBoardsCommandArgs args)
   at OctoshiftCLI.Extensions.CommandExtensions.RunHandler[TArgs,THandler](TArgs args, ServiceProvider sp, CommandBase`2 command)
   at OctoshiftCLI.Extensions.CommandExtensions.<>c__DisplayClass1_0`3.<<ConfigureCommand>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext )
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

Reproduction Steps

As above, using:

  • ADO Token with Full Access
  • GitHub classic token with admin:org, repo, workflow
  • gh version 2.51.0 (2024-06-13)
  • ado2gh CLI [v1.8.0]
@dw-alexangas dw-alexangas added the bug Something isn't working label Jun 19, 2024
@ArinGhazarian
Copy link
Collaborator

👋 thanks for filing an issue. So the problem here is the ADO token, it needs to have access to all organizations otherwise the integrate-boards command won't work.

@dw-alexangas
Copy link
Author

@ArinGhazarian Yes I think I came across that. The token does have full access - please see reproduction steps. Unfortunately not working. (Thank you for creating a task about improving the help text, this is definitely out-of-date.)

@dylan-smith
Copy link
Collaborator

It’s needs more than just Full Access it also needs the All Orgs setting on the token.

Image

@dw-alexangas
Copy link
Author

dw-alexangas commented Jun 24, 2024

@dylan-smith Tested this again and unfortunately still getting the same behaviour. Token is configured like this:

image

By the way, I am Organization Owner, Project Collection Administrator, and Project Administrator.

@dylan-smith
Copy link
Collaborator

Best way to get additional help is to create a GitHub support ticket. Not sure off the top of my head why this would happen.

@dw-alexangas
Copy link
Author

@dylan-smith @ArinGhazarian The cause of this was user error (missing GitHub connection in ADO). However the unhelpful error message wasted a lot of time. So I've created a PR for this. Unfortunately i'm not able to reopen this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants