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

GraphQL: Field 'rules' doesn't exist on type 'Ref'. #5038

Open
and-ku opened this issue Oct 24, 2024 · 4 comments
Open

GraphQL: Field 'rules' doesn't exist on type 'Ref'. #5038

and-ku opened this issue Oct 24, 2024 · 4 comments
Labels
bug Something isn't working provider/github

Comments

@and-ku
Copy link

and-ku commented Oct 24, 2024

Overview of the Issue

I keep getting this error. I am running GHE on prem.

GraphQL: Field 'rules' doesn't exist on type 'Ref'. Continuing with mergeable and approved assumed false

Atlantis Version: 0.30.0
GHE Version: GitHub Enterprise Server 3.12.8

Logs

Logs
{"level":"debug","ts":"2024-10-24T19:34:10.547Z","caller":"vcs/github_client.go:815","msg":"AllowMergeableBypassApply feature flag is enabled - attempting to bypass apply from mergeable requirements","json":{"repo":"XXXXXXXX","pull":"40"}}
{"level":"debug","ts":"2024-10-24T19:34:10.945Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github_event.comment_created.success_200","value":1,"tags":{"base_repo":"XXXXXXXX","pr_number":"40"},"type":"counter"}}
{"level":"debug","ts":"2024-10-24T19:34:10.945Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github.update_status.execution_success","value":1,"tags":{"base_repo":"XXXXXXXX","pr_number":"40"},"type":"counter"}}
{"level":"debug","ts":"2024-10-24T19:34:10.945Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github.pull_is_approved.execution_success","value":1,"tags":{"base_repo":"XXXXXXXX","pr_number":"40"},"type":"counter"}}
{"level":"debug","ts":"2024-10-24T19:34:10.945Z","caller":"metrics/debug.go:42","msg":"counter","json":{"name":"atlantis.github.get_pull_request.execution_success","value":1,"tags":{"base_repo":"XXXXXXXX","pr_number":"40"},"type":"counter"}}
{"level":"error","ts":"2024-10-24T19:34:11.345Z","caller":"vcs/instrumented_client.go:200","msg":"Unable to check pull mergeable status, error: getting pull request status: fetching rulesets, branch protections and status checks from GraphQL: Field 'rules' doesn't exist on type 'Ref'","json":{"repo":"XXXXXXXX","pull":"40"},"stacktrace":"github.com/runatlantis/atlantis/server/events/vcs.(*InstrumentedClient).PullIsMergeable\n\tgithub.com/runatlantis/atlantis/server/events/vcs/instrumented_client.go:200\ngithub.com/runatlantis/atlantis/server/events/vcs.(*ClientProxy).PullIsMergeable\n\tgithub.com/runatlantis/atlantis/server/events/vcs/proxy.go:85\ngithub.com/runatlantis/atlantis/server/events/vcs.(*pullReqStatusFetcher).FetchPullStatus\n\tgithub.com/runatlantis/atlantis/server/events/vcs/pull_status_fetcher.go:33\ngithub.com/runatlantis/atlantis/server/events.(*ApplyCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/apply_command_runner.go:106\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunCommentCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:389"}
{"level":"debug","ts":"2024-10-24T19:34:11.345Z","caller":"metrics/debug.go:52","msg":"timer","json":{"name":"atlantis.github.pull_is_mergeable.execution_time","value":0.937468306,"tags":{"base_repo":"XXXXXXXX","pr_number":"40"},"type":"timer"}}
@and-ku and-ku added the bug Something isn't working label Oct 24, 2024
Copy link

dosubot bot commented Oct 24, 2024

Hey @and-ku! I'm here to help you with any bugs, questions, or contributions. Let's tackle this together!

The error message "GraphQL: Field 'rules' doesn't exist on type 'Ref'" suggests that the GraphQL query being used is trying to access a field that is not available in your current GitHub Enterprise (GHE) on-premise version. This could be due to differences in the GraphQL API version or features supported by your GHE instance compared to GitHub's cloud offering.

Here are a few steps you can take to address this issue:

  1. Check GHE Version: Ensure that your GHE version supports the GraphQL features being used. You might need to upgrade your GHE instance if it's outdated.

  2. Review GraphQL Queries: If you have access to the Atlantis codebase, review the GraphQL queries to ensure they are compatible with your GHE version. Unfortunately, I couldn't find specific details about where these queries are defined in the Atlantis codebase.

  3. Feature Flag: The logs mention that the AllowMergeableBypassApply feature flag is enabled. This flag allows the mergeable check to bypass the apply required check, which might be relevant if you're facing issues with mergeability checks [1][2].

  4. Contact Support: If the issue persists, consider reaching out to your GHE support for assistance with compatibility issues.

These steps should help you diagnose and potentially resolve the issue with the GraphQL query.

To continue talking to Dosu, mention @dosu.

@and-ku
Copy link
Author

and-ku commented Oct 24, 2024

It looks like this is where it was added just recently. This change has broken my ability to upgrade.

https://github.com/runatlantis/atlantis/blame/release-0.30/server/events/vcs/github_client.go#L578

#4193

@arnzchen
Copy link

I'm seeing this as well

@stasostrovskyi
Copy link
Contributor

Quick search shows that latest version of GHES is 3.14. Anyone running on that version and can test this?

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

No branches or pull requests

3 participants