Skip to content

fix: org detection failure on ghec-dr endpoints#3422

Open
ebk45 wants to merge 4 commits into
integrations:mainfrom
ebk45:fix/ghec-dr-org-detection
Open

fix: org detection failure on ghec-dr endpoints#3422
ebk45 wants to merge 4 commits into
integrations:mainfrom
ebk45:fix/ghec-dr-org-detection

Conversation

@ebk45
Copy link
Copy Markdown

@ebk45 ebk45 commented May 13, 2026

Resolves #2626


Before the change?

  • When base_url is a GHEC-DR endpoint (https://api.*.ghe.com/), Organizations.Get() fails due to incorrect URL construction in the go-github library. The error is silently discarded, leaving IsOrganization as false. Any resource or data source that calls checkOrganization() (e.g. github_external_groups) then fails with the misleading error: this resource can only be used in the context of an organization, "XYZ" is a user.

After the change?

  • When Organizations.Get() fails, the provider logs a [WARN] and falls back to Users.Get() to check the owner's type field. Since /users/{owner} works correctly on GHEC-DR endpoints, the organization is detected and IsOrganization is set to true. Downstream resources work as expected.

Pull request checklist

  • [N/A] Schema migrations have been created if needed (example)
  • Tests for the changes have been added (for bug fixes / features)
  • [N/A] Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

  • Yes
  • No

@github-actions
Copy link
Copy Markdown

👋 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! 🚀

@github-actions github-actions Bot added the Type: Bug Something isn't working as documented label May 13, 2026
@ebk45 ebk45 marked this pull request as draft May 13, 2026 08:23
@ebk45 ebk45 marked this pull request as ready for review May 13, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Something isn't working as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Create github_team resource causes error when created under EMU EU Data Residency Organization

3 participants