You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "makhele (via GitHub)" <gi...@apache.org> on 2024/09/26 22:52:51 UTC
[I] Drill By not Working on Embeded app when not logged in to Superset [superset]
makhele opened a new issue, #30409:
URL: https://github.com/apache/superset/issues/30409
### 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
- [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [X] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Drill By not Working on Embeded app when not logged in to Superset [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #30409:
URL: https://github.com/apache/superset/issues/30409#issuecomment-2378085509
<!-- Greeting -->
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!
<!-- Answer -->
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:
```tsx
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:
```tsx
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 <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/components/Chart/DrillBy/DrillByModal.tsx)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/components/Chart/DrillBy/DrillByMenuItems.tsx)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Drill By not Working on Embeded app when not logged in to Superset [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #30409:
URL: https://github.com/apache/superset/issues/30409#issuecomment-2786825860
Closing this one as a duplicate of #29973, and because it's been silent for > 6 months.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Drill By not Working on Embeded app when not logged in to Superset [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #30409: Drill By not Working on Embeded app when not logged in to Superset
URL: https://github.com/apache/superset/issues/30409
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org