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

Scale-up lambda fails with error - HttpError: Integration not found in ghe.com #4364

Open
neethu-p opened this issue Jan 15, 2025 · 9 comments

Comments

@neethu-p
Copy link
Contributor

neethu-p commented Jan 15, 2025

Hello Team,

I am attempting to implement the multi-runner module in a our GitHub Enterprise Cloud with data residency instance hosted on companyname.ghe.com. With this data residency feature of Github, the API URL has changed from api.github.com to api.companyname.ghe.com.

In this case the creatAuthAppfunction in scale-up.ts fails, as the API endpoint is not set .Hence the scale-up lambda function is failing with the following error: "message": "Ignoring error: HttpError: Integration not found - https://docs.github.com/rest. `Could you confirm if this module is currently supported in the GitHub with ghe.com domain?

It works fine in our in Enterprise and public Cloud GH instances.

@npalm
Copy link
Member

npalm commented Jan 15, 2025

I have no option to test the module on ghe.com. The module should work on GHES, but also that version I cannot test. You could try to configure the module with GHES. If I am coorect you can set the API endpoint in that case.

Would be great to get people on this OS module that can support and test those cases.

@neethu-p
Copy link
Contributor Author

neethu-p commented Jan 15, 2025

In GHES the API endpoint is ghesUrl/api/v3, which works as expected. But in our case the API endpoint is https://api.companyname.ghe.com, for which I don't see any option to set the api url.
I can try to open up a PR with supporting changes

@npalm
Copy link
Member

npalm commented Jan 15, 2025

Had a quick look in the code, but maybe you can just pass the url in the ghes parameter:

export async function createOctokitClient(token: string, ghesApiUrl = ''): Promise<Octokit> {
const CustomOctokit = Octokit.plugin(throttling);
const ocktokitOptions: OctokitOptions = {
auth: token,
};
if (ghesApiUrl) {
ocktokitOptions.baseUrl = ghesApiUrl;
ocktokitOptions.previews = ['antiope'];
}

@neethu-p
Copy link
Contributor Author

I think the ghesApiUrl is derived from the ghes-url param here -

@npalm
Copy link
Member

npalm commented Jan 15, 2025

Yes I think you are right, so it is hard-coded :( (partially).

I think it would be better to make it in the lambda more generic. In case we could get it backwards compatible via terraform that would be nice. But would certainly avoid having more cased in the code, should work if we just inject the full url. Would be great if uyou can propose a PR.

You can run a quick test, by just chainging the the Lambda code (even hardcoded). And run yarn install && yarn dist to build packages. Just to quickly test if that is the only change you need.

@neethu-p
Copy link
Contributor Author

Hello, I have raised a PR with changes here - #4367. Please have a look

npalm added a commit that referenced this issue Jan 28, 2025
Hello team,
This PR is raised to enhance the module’s functionality to support
GitHub Enterprise Cloud with data residency.
Reference issue -
#4364

Below are the details of the changes: 

1. The PR introduces support for GitHub Enterprise Cloud instances
hosted on a dedicated subdomain of `ghe.com`, in addition to the current
handling of `github.com` and GHES.

2.The primary difference between `github.com` and `ghe.com` is the API
access URL. While `github.com` uses `https://api.github.com`, GHE Cloud
instances use the format `https://api.companyname.ghe.com`.

3. To accommodate this, I have utilised the existing `ghes_url`
parameter. The new `ghe.com` URL can be passed to this parameter for
smooth integration.

4. This change has been thoroughly tested across all GitHub instances:
GHES, `github.com`, and `ghe.com`, ensuring compatibility and
reliability.
Please review the PR and let me know if you have any feedback or
suggestions.

---------

Co-authored-by: Neethu Pandhaplavil <[email protected]>
Co-authored-by: Jørgen Jervidalo <[email protected]>
Co-authored-by: Niek Palm <[email protected]>
@npalm
Copy link
Member

npalm commented Jan 28, 2025

@neethu-p reverted your PR due to failing CI, see links in the PR and revert PR.

@neethu-p
Copy link
Contributor Author

A new PR is opened up to address CI issue. - #4390

@neethu-p
Copy link
Contributor Author

The build is fixed in the new PR. Please have a look:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants