Testing & Debugging
Fix embed problems
Find why an embedded dashboard or metric is blank, slow or shows an error, and fix it.
Find the failing step
An embed loads in four steps. Check them in this order:
- The plugin loads and registers
dbn-dashboardanddbn-metric. - Your server makes a guest token with the data app API token.
- The embed sends the token to the Databrain API and gets the dashboard.
- Each chart runs its query on your warehouse.
Open the browser’s developer tools on your page, and look at the console and the network tab.
The embed is blank
Run this in the browser console:
({
dashboard: Boolean(customElements.get('dbn-dashboard')),
metric: Boolean(customElements.get('dbn-metric')),
})- Both are
false. The plugin did not load. Check that you import@databrainhq/plugin/webonce, before the component renders, and that the page has no script error. true, but nothing shows. Give the element a width and a height. Check thattokenanddashboard-id(ormetric-id) are set and not empty.- No request to the Databrain API. The token is missing, or your framework renders the element before the token arrives. Render it after you have the token.
The embed shows an error
| You see | Cause | Fix |
|---|---|---|
| The request is refused with a token error | The guest token expired or is not valid | Make a new guest token on your server |
UNAUTHORIZED_ORIGIN | Your page’s domain is not allowed | Add the domain in the data app’s Domains tab. See Whitelist domains |
DASHBOARD_NOT_FOUND | The dashboard-id is not an embed of the token’s data app | Use the embed’s dashboard ID from the data app’s Embeds tab, and a guest token from the same data app |
| “This dashboard can’t load right now. Contact your admin.” | A cause written for you, the integrator, not for the viewer | Read the error body in the network tab: code, hint and cause. See Read API and embed errors |
| “This chart did not load” or “This dashboard did not load.” with Retry | The server did not answer in 60 seconds | Select Retry. If it repeats, the warehouse query is slow. Check the datasource |
| Requests go to Databrain cloud on a self-hosted install | The plugin does not know your API address | Set base-url. See Point embeds at your instance |
A failed chart or dashboard shows Request ID: <id> with Copy. It is the x-request-id of the failed response. A timeout has no ID, because no answer came back.
To show your own text instead of the default error, set customMessages.error in the component options.
The data looks wrong
- A client sees another client’s rows. Stop and check tenancy first. The data app’s Tenancy tab shows what is not set up. Check that the guest token carries the right
clientId. - No rows. Check the filters in the guest token and the
clientId. - The numbers differ from your warehouse. Check the metric’s filters and time range. Then check the cache in workspace settings.
The layout changes on a narrow page
Below 1024 pixels wide, an embedded dashboard uses one column, even on a wide screen. Tables show as labelled records. This follows the width of the embed, not the screen. Give the element more width to keep the grid.
Ask for help
Send support:
- The request ID or the
reffrom the error, and the time. - The plugin version (
npm ls @databrainhq/plugin) and the page URL. - What you expected and what you saw.
Do not send guest tokens, API tokens or customer data. Admins can find the same request in Settings > Diagnostics > Logs by its ref.