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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to