Skip to content

Self-hosted grafana instances on prefix path cannot be connected >1.14.4 #5533

Open
@MiddleMan5

Description

@MiddleMan5

What went wrong?

What happened:
When upgrading from 1.13.3 to 1.14.4 the plugin installation fails. After digging into the code it appears that the grafanaUrl that is configured from the grafana ui settings is sanitized incorrectly before it is stored in the database here:

Plugin installation fails with "Plugin Not Connected"

Image
and following error logs:

2025-05-07 19:39:10 source=engine:app google_trace_id=none logger=apps.grafana_plugin.helpers.client Error connecting to api instance 404 Client Error: Not Found for url: http://localhost:3000/api/org

Note grafana url is now missing /grafana path prefix

This appears to be caused by the python urljoin call here which ignores path prefixes without a trailing slash

See test below:

from urllib.parse import urljoin

print(urljoin("http://localhost:3000/grafana", "api/org"))
print(urljoin("http://localhost:3000/grafana/", "api/org"))

Output

http://localhost:3000/api/org
http://localhost:3000/grafana/api/org

How do we reproduce it?

  1. Deploy grafana on a /grafana path prefix
  2. Install and configure oncall plugin with localhost:3000/grafana/ note trailing slash
  3. Plugin installation fails with "Plugin Not Connected"

Grafana OnCall Version

1.14.4

Product Area

API

Grafana OnCall Platform?

Kubernetes

User's Browser?

No response

Anything else to add?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions