Open
Description
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"
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?
- Deploy grafana on a
/grafana
path prefix - Install and configure oncall plugin with localhost:3000/grafana/ note trailing slash
- 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