Getting Unauthorized Exception when loading dashboard and hitting datasource api

I am getting “Unauthorized” error while loading dashboard.

When checked on network tab, I see its failing in below api with 401 error.
https://<host_ip>/grafana/api/frontend-metrics
Data sent in above request was:

{
  "events": [
    {
      "name": "frontend_boot_first-paint_time_seconds",
      "value": 0.838
    },
    {
      "name": "frontend_boot_first-contentful-paint_time_seconds",
      "value": 1.653
    },
    {
      "name": "frontend_boot_load_time_seconds",
      "value": 2.027
    }
  ]
}

Multiple other apis pass though with 200 response. for example -

 https://<host_ip>/grafana/api/datasources,
https://<host_ip>/grafana/api/datasources/uid/Bj7n4PnIk

However,

https://<host_ip>/grafana/api/datasources/proxy/1/api/v1/query

call to test datasource also returns 404 .

Any idea on what could be going wrong here. Anonymous auth is enabled true with below conf.

[auth.anonymous]
enabled = true
org_name = Main Org.
org_role = Admin

I guess datasource authentification is incorrect.