fix: append /api/v3 and /api/graphql paths for GHEC Data Residency hosts#2997
Closed
JiayangZhou wants to merge 2 commits intointegrations:mainfrom
Closed
fix: append /api/v3 and /api/graphql paths for GHEC Data Residency hosts#2997JiayangZhou wants to merge 2 commits intointegrations:mainfrom
JiayangZhou wants to merge 2 commits intointegrations:mainfrom
Conversation
GHEC Data Residency hosts (*.ghe.com) require the /api/v3 and /api/graphql/ paths to be appended, similar to GitHub Enterprise Server instances. The original PR integrations#2547 incorrectly assumed that GHEC Data Residency hosts behave like github.com (without requiring /api/v3 path). However, in practice these hosts behave like GHE Server and need the API paths appended. This fix removes the GHECDataResidencyHostMatch exclusion from the path construction logic, so all non-github.com hosts (including *.ghe.com) will have the correct API paths appended. Fixes the regression introduced in v6.6.0 where users had to remove /api/v3 from their base_url but the provider then failed to reach the API correctly.
|
👋 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 |
JiayangZhou
commented
Dec 19, 2025
| if hostname != DotComHost && !GHECDataResidencyHostMatch.MatchString(hostname) { | ||
| if hostname != DotComHost { | ||
| // GHE Server and GHEC Data Residency hosts need /api/v3 path | ||
| baseURL.Path = path.Join(baseURL.Path, "api/v3/") |
Contributor
Author
There was a problem hiding this comment.
should we start to append api/v3/ for GHEC Data Residency hosts? @deiga please have a look at this Pr when you get time thanks!
Contributor
Author
There was a problem hiding this comment.
sorry just pulled upstream, i think it already contained the fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a regression introduced in v6.6.0 where GHEC Data Residency hosts (
*.ghe.com) were incorrectly treated likegithub.com, resulting in the API being unreachable.Problem
In PR #2547, support for GHEC Data Residency was added with the assumption that
*.ghe.comhosts behave likegithub.com(i.e., they don't need/api/v3or/api/graphql/paths). However, this assumption is incorrect - these hosts actually behave like GitHub Enterprise Server and do require the API paths.Symptoms
base_url = "https://customer.ghe.com/api/v3"and it worked/api/v3, but then the provider fails to reach the APIthis resource can only be used in the context of an organization, "ORG_NAME" is a userSolution
Remove the
GHECDataResidencyHostMatchexclusion from the path construction logic in:config.go:NewGraphQLClient()andNewRESTClient()apps.go:getInstallationAccessToken()This ensures all non-
api.github.comhosts (including*.ghe.com) will have the correct API paths appended.Testing
hidden-staging.ghe.com)terraform plansuccessfully refreshes all GitHub resourcesRelated Issues
Fixes the issue reported in the diff comparison: v6.5.0...v6.6.0#diff-062b7a475c9ddd7765fd96c620a3f7854307a4b68c0ff57db24b9d912b5bcec9R88