Hi, I seem to have issue with embedding Grafana panels. I embed about 4 panels on my application dashboard through iframe, however at start of each day 1 out of 4 panels load into Grafana homepage instead of the panel, I suspect it could be issue with Grafana refreshing the session (thus then redirecting to homepage) and then rendering rest of the 3 panels correctly. While 1st panel is incorrect and shows a grafana homepage.
I will try to provide screenshot later as now there is no need to refresh session so everything works alright, but I’ll try to illustrate it in the meantime.
Any ideas on how to fix this? Thank you.
I am running OSS version, self-hosted.
Thanks for any advice.
Here are the screenshots I was able to reproduce it later in evening
Also this is the embed URL i am using:
You know, now that I think about it, it seems to me that it could be caused by the panels being loaded at the same time.
Here is my idea what happens
panels start to load at once
first and second panel cause session refresh
third panel loads in with refreshed session
fourth panel loads with refreshed session, but somehow maybe got redirected to wrong panel ID because grafana thought it was completing a session refresh from the second panel? (note it loads the second panel actually)
just saying my thoughts outloud I haven’t looked in the grafana code
I can’t add any details. Just wanted to say you’re not alone. I’m having the same issue on my local grafana Installation.
I’m running Grafana v10.3.1 (00a22ff8b2) from official docker Image. Grafana is behind a Caddy Reverse Proxy and the Panels are embedded in a node-red dashboard. Sometimes the wrong panels are loaded. Sometimes the Welcome Page ist shown.
Had a look at the traces when instead of the panels the welcome view is shown.
Looks like authentication is requested somehow even though anonymous viewing is enabled and allow_embedding is true too.
logger=authn.service t=2024-02-03T23:47:49.698807576Z level=warn msg="Failed to authenticate request" client=auth.client.session error="user token not found"
logger=context userId=0 orgId=0 uname= t=2024-02-03T23:47:49.688282529Z level=info msg="Request Completed" method=GET path=/user/auth-tokens/rotate status=302 remote_addr=192.168.2.240 time_ms=10 duration=10.514671ms size=147 referer=https://****/ handler=/user/auth-tokens/rotate
logger=context userId=1 orgId=1 uname=admin t=2024-02-03T23:47:49.697900907Z level=info msg="Request Completed" method=GET path=/user/auth-tokens/rotate status=302 remote_addr=192.168.2.240 time_ms=16 duration=16.970418ms size=148 referer=https://****/ handler=/user/auth-tokens/rotate
logger=authn.service t=2024-02-03T23:47:49.69898768Z level=warn msg="Failed to authenticate request" client=auth.client.session error="user token not found"
I have the same problem! I have disabled anonymous access, I am authenticated in Grafana, and I have authentication cookies in my browser. However, at random moments, the home page is displayed in the application where Grafana is embedded. Do you have any ideas what might be causing this issue? I’m using Grafana v10.3.1 (00a22ff8b2).
Honestly I haven’t tried to find out what’s going on yet.
For example I have one page with six iframes each embedding one panel. When entering the page sometime all iframes show the same panel. Sometimes some are correct and sometimes they show the welcome page instead of any panel.
When reloading the page all is fine. When switching to another page with other iframes embedding other panels everything is working fine. Even when closing the browser, starting again and going to that page again all is fine.
It seems to happen when the page hasn’t been accessed for a while. Maybe this has somehow to do with cookies and tokens/sessions?
Edit: When the issue occurs the grafana logs show that the iframe was redirected for token rotation. e.g.
logger=context userId=0 orgId=0 uname= t=2024-02-18T11:32:32.173156618Z level=info msg=“Request Completed” method=GET path=/user/auth-tokens/rotate status=302 remote_addr=192.168.. time_ms=13 duration=13.132481ms size=118 referer=https://****/ handler=/user/auth-tokens/rotate
From default settings:
# How often should auth tokens be rotated for authenticated users when being active. The default is each 10 minutes.
token_rotation_interval_minutes = 10
Not sure why a token is required at all when auth.anonymous is enabled.