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

[BUG]: Getting issue by issue number panics if there is a label present on issue #119

Open
1 task done
kfcampbell opened this issue Oct 17, 2024 · 1 comment
Open
1 task done
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented

Comments

@kfcampbell
Copy link
Member

What happened?

I'm using the following code snippet:

	client, err := pkg.NewApiClient(
		pkg.WithUserAgent("my-user-agent"),
		pkg.WithRequestTimeout(5*time.Second),
		pkg.WithBaseUrl("https://api.github.com"),
		pkg.WithTokenAuthentication(os.Getenv("GITHUB_TOKEN")),
	)

	if err != nil {
		log.Fatalf("error creating client: %v", err)
	}

	queryParams := &abs.DefaultQueryParameters{}
	requestConfig := &abs.RequestConfiguration[abs.DefaultQueryParameters]{
		QueryParameters: queryParams,
	}

	issue, err := client.Repos().ByOwnerId("hilli").ByRepoId("issue-test").Issues().ByIssue_number(1).Get(context.Background(), requestConfig)
	if err != nil {
		log.Fatalf("error getting issue: %v", err)
	}
	fmt.Printf("issue: %+v", issue)

This code panics, since hilli/issue-test#1 has a label on it. There's some kind of issue going on in which labels aren't being deserialized correctly. See a debugging screenshot in which we attempt to force unwrap a nil value for the label:

Image

The final panic is:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9e6418]

By contrast, the same request to kfcampbell/a-repo#1 succeeds, as it doesn't have any issues in place:

issue: &{active_lock_reason:<nil> additionalData:map[] assignee:<nil> assignees:[] author_association:0xc0000152d8 body:0xc000234d40 body_html:<nil> body_text:<nil> closed_at:<nil> closed_by:<nil> comments:0xc0000152e0 comments_url:0xc000234340 created_at:0xc00025fa40 draft:<nil> events_url:0xc000234390 html_url:0xc0002343e0 id:0xc000015300 labels:[] labels_url:0xc0002342f0 locked:0xc000014cee milestone:<nil> node_id:0xc000234460 number:0xc0000152d4 performed_via_github_app:<nil> pull_request:<nil> reactions:0xc00026d260 repository:<nil> repository_url:0xc0002342a0 state:0xc000234ac0 state_reason:<nil> timeline_url:0xc000234fe0 title:0xc0002344e0 updated_at:0xc00025fa28 url:0xc000234250 user:0xc00013e580}

Note that label IDs have already been updated to int64 from what I can tell.

Versions

Most recent go-sdk from source (v0.0.29).

Code of Conduct

  • I agree to follow this project's Code of Conduct
@kfcampbell kfcampbell added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Oct 17, 2024
Copy link

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented
Projects
Status: 🆕 Triage
Development

No branches or pull requests

1 participant