Loading
Skip CustomersDot subscription queries when the proxy is absent
What does this MR do and why?
Fix console errors and Sentry noise on usage quotas pages in self-managed instances and tests.
Six usage quota components query subscriptionPermissions through GitLab's CustomersDot proxy. The proxy returns 404 as HTML when the feature is unavailable (everywhere except GitLab.com). Apollo cannot parse HTML as JSON and logs parse errors to the console and Sentry. The query answers only control UI labels, so skipping it when unavailable gives the same behavior as a failed request but without the noise.
Changes:
- Backend: expose a gon flag telling the frontend whether the proxy exists
- Backend: return JSON error from the proxy instead of HTML
- Frontend: skip the query when the flag indicates the proxy is unavailable
- Tests: verify the flag and query skipping work
References
- Part of section D of #628901 (console errors in feature specs)
- Console check and baseline allowlist MR that surfaced it: !255207 (closed)
- Reveal pipeline jobs showing the error: https://gitlab.com/gitlab-org/gitlab/-/jobs/16462296375, https://gitlab.com/gitlab-org/gitlab/-/jobs/16462296276
Screenshots or screen recordings
Not applicable. No visible change. Only console errors and Sentry noise are removed.
How to set up and validate locally
- Run
yarn jest ee/spec/frontend/lib/customers_dot_graphql_spec.js ee/spec/frontend/usage_quotas - Run
bundle exec rspec ee/spec/lib/ee/gitlab/gon_helper_spec.rb ee/spec/requests/customers_dot/proxy_controller_spec.rb - In a GDK that is not simulating GitLab.com, open a group's Settings > Usage quotas, Pipelines tab, with the browser network and console panels open
- On master there is a request to
/-/customers_dot/proxy/graphqlthat returns 404 and a console error. On this branch there is no such request and no console error. - Optionally set
GITLAB_SIMULATE_SAAS=1and confirm the request is made again.
MR acceptance checklist
This MR has been evaluated against the acceptance checklist.