Open makhele opened 2 months ago
Hi @makhele! I'm here to help you with your Superset dashboard issue. I can assist with bug fixes, answer your questions, and guide you on becoming a contributor. Let's work together to resolve the problem!
I found a similar issue that might be relevant to your problem. The "Drill By" feature in an embedded Superset dashboard within an Angular app does not work when not logged in because the dataset API request fails with a 404 response. This issue is likely due to insufficient permissions or lack of authentication, which prevents the necessary data from being loaded.
The error message "Failed to load dimension for drill by" and the 404 response indicate that the API endpoint for fetching the dataset dimensions is not accessible without proper authentication. This is evident from the following code snippet, which shows that the application attempts to fetch chart data and handle the response:
useEffect(() => {
if (drilledFormData) {
const [useLegacyApi] = getQuerySettings(drilledFormData);
setIsChartDataLoading(true);
setChartDataResult(undefined);
getChartDataRequest({
formData: drilledFormData,
})
.then(({ response, json }) =>
handleChartDataResponse(response, json, useLegacyApi),
)
.then(queriesResponse => {
setChartDataResult(queriesResponse);
})
.catch(() => {
addDangerToast(t('Failed to load chart data.'));
})
.finally(() => {
setIsChartDataLoading(false);
});
}
}, [addDangerToast, drilledFormData]);
Additionally, the DrillByMenuItems
component in Superset's frontend code shows that the application attempts to load drill-by options using the dataset ID and form data. If the user is not authenticated, the request to the dataset API endpoint fails, resulting in the error:
useEffect(() => {
async function loadOptions() {
const datasetId = Number(formData.datasource.split('__')[0]);
try {
setIsLoadingColumns(true);
let response: JsonResponse;
if (loadDrillByOptions) {
response = await loadDrillByOptions(datasetId, formData);
} else {
response = await cachedSupersetGet({
endpoint: `/api/v1/dataset/${datasetId}?q=${queryString}`,
});
}
const { json } = response;
const { result } = json;
setDataset(result);
setColumns(
ensureIsArray(result.columns)
.filter(column => column.groupby)
.filter(
column =>
!ensureIsArray(
formData[drillByConfig?.groupbyFieldName ?? ''],
).includes(column.column_name) &&
column.column_name !== formData.x_axis &&
ensureIsArray(excludedColumns)?.every(
excludedCol => excludedCol.column_name !== column.column_name,
),
),
);
} catch (error) {
logging.error(error);
supersetGetCache.delete(`/api/v1/dataset/${datasetId}`);
addDangerToast(t('Failed to load dimensions for drill by'));
} finally {
setIsLoadingColumns(false);
}
}
if (handlesDimensionContextMenu && hasDrillBy) {
loadOptions();
}
}, [
addDangerToast,
drillByConfig?.groupbyFieldName,
excludedColumns,
formData,
handlesDimensionContextMenu,
hasDrillBy,
]);
To resolve this issue, ensure that the user is authenticated and has the necessary permissions to access the dataset API [1][2].
To continue talking to Dosu, mention @dosu.
Might be related to https://github.com/apache/superset/issues/29973
Bug description
I have an Angular app where a Superset dashboard is embeded,
When Logged in to superset the Drill By on a Chart is working on the angular app
When I log out of superset I get the error
Failed to load dimension for drill by
from the devtools the request to
https://myappdomain/api/v1/dataset/5
returns a 404 with message{"message":"Not found"}
Note the user is admin and superset and the angular app are on same domain
How to reproduce the bug
.
Screenshots/recordings
.
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist