apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
62.32k stars 13.69k forks source link

Error when saving a dashboard after editing #24525

Closed ya-msh closed 6 months ago

ya-msh commented 1 year ago

When I open a dashboard in "EDIT" mode and make a change, "SAVE" function doesn't work.

How to reproduce the bug

  1. From Home, create a new dashboard
  2. At this time "SAVE" button is unavailable (-> grey)
  3. Do any change (rename title, add a chart or layout element)
  4. "SAVE" button becomes available (-> blue)
  5. Clic on "SAVE" button

Expected results

The modified dashboard is saved and a success message is displayed.

Actual results

Dashboard is not saved and an error message is displayed : "Sorry, there was an error saving this dashboard: [object Object]"

In Flask logs:

--Logs after "SAVE" in "EDIT DASHBOARD" mode => warning + response code 400
2023-06-26 15:35:26,358:DEBUG:superset.stats_logger:[36m[stats_logger] (incr) DashboardRestApi.put.warning[0m
2023-06-26 15:35:26,358:DEBUG:superset.stats_logger:[36m[stats_logger] (timing) DashboardRestApi.put.time | 6.051858072169125 [0m
2023-06-26 15:35:26,358:INFO:werkzeug:127.0.0.1 - - [26/Jun/2023 15:35:26] "[31m[1mPUT /api/v1/dashboard/1 HTTP/1.1[0m" 400 -

--Logs after renaming title" from "Dashboard properties" panel => success + response code 200
2023-06-26 15:48:22,248:DEBUG:superset.stats_logger:[36m[stats_logger] (incr) DashboardRestApi.put.success[0m
2023-06-26 15:48:22,248:DEBUG:superset.stats_logger:[36m[stats_logger] (timing) DashboardRestApi.put.time | 16.117947991006076 [0m
2023-06-26 15:48:22,249:INFO:werkzeug:127.0.0.1 - - [26/Jun/2023 15:48:22] "PUT /api/v1/dashboard/1 HTTP/1.1" 200 -

Screenshots

Superset_save_dashboard_error

Environment

Checklist

Make sure to follow these steps before submitting your issue - thank you!

Additional context

Issue occurs only with "EDIT DASHBOARD" mode, after opening an existing dashboard or directly next creation of new dashboard from home. Some other actions on dashboards work fine:

sfirke commented 1 year ago

Could be related to https://github.com/apache/superset/issues/22106 (unsolved)

roks531 commented 1 year ago

Exactly the same problem. I have it just for one dashboard as I noticed, some of the others I tested work normally.

roks531 commented 1 year ago

as for me i recreated the dashboard with same charts, same filters, css and deleted the old one, which couldnt be updated in any way (filter updates or edit dashboard name, owner, nothing worked). Visually, functionally the dashboard now works the same as before...I dont know what the root cause of this is, but it happened on an update of apache superset to 2.1.0-dev.

I also looked at the browser console and as it seems there was a PUT problem, but i didnt bother investigating further, as it was faster to recreate the dashboard for me.

Chrome browser logs:

index.js:65 PUT http://domain.com:8088/api/v1/dashboard/12 400 (BAD REQUEST) n @ index.js:65 (anonymous) @ index.js:125 (anonymous) @ index.js:63 (anonymous) @ callApi.ts:180 u @ callApiAndParseWithTimeout.ts:32 request @ SupersetClientClass.ts:202 await in request (async) put @ SupersetClientClass.ts:180 put @ SupersetClient.ts:50 s @ dashboardState.js:399 Promise.then (async) (anonymous) @ dashboardState.js:440 (anonymous) @ index.js:8 (anonymous) @ redux.js:477 overwriteDashboard @ index.jsx:418 X @ button.js:200 l @ react-dom.production.min.js:14 p @ react-dom.production.min.js:14 (anonymous) @ react-dom.production.min.js:14 b @ react-dom.production.min.js:15 ot @ react-dom.production.min.js:52 rt @ react-dom.production.min.js:51 it @ react-dom.production.min.js:52 ft @ react-dom.production.min.js:56 R @ react-dom.production.min.js:287 F @ react-dom.production.min.js:19 Jt @ react-dom.production.min.js:70 Gt @ react-dom.production.min.js:69 t.unstable_runWithPriority @ scheduler.production.min.js:19 Za @ react-dom.production.min.js:122 z @ react-dom.production.min.js:287 $t @ react-dom.production.min.js:68

ya-msh commented 1 year ago

Thanks for your sharing! Situation is unfortunately worst for me: I have a fresh install of Superset in 2.1.0 and no dashboard can be saved from "EDIT DASHBOARD" mode, even an empty dashboard without charts. I removed and recreated the metadata database without examples, no change.

Good idea to look at browser log. I have some warnings like: Warning: ExpectedonClicklistener to be a function, instead got a value ofnumbertype.

And for the PUT request Request: {"certified_by":"","certification_details":"","css":"","dashboard_title":"test","slug":null,"owners":[1],"json_metadata":"{\"color_scheme\":\"\",\"positions\":{\"DASHBOARD_VERSION_KEY\":\"v2\",\"ROOT_ID\":{\"type\":\"ROOT\",\"id\":\"ROOT_ID\",\"children\":[\"GRID_ID\"]},\"GRID_ID\":{\"type\":\"GRID\",\"id\":\"GRID_ID\",\"children\":[],\"parents\":[\"ROOT_ID\"]},\"HEADER_ID\":{\"id\":\"HEADER_ID\",\"type\":\"HEADER\",\"meta\":{\"text\":\"test\"}}},\"refresh_frequency\":0,\"shared_label_colors\":{},\"color_scheme_domain\":[],\"expanded_slices\":{},\"label_colors\":{},\"timed_refresh_immune_slices\":[],\"cross_filters_enabled\":false,\"default_filters\":\"{}\",\"filter_scopes\":{},\"chart_configuration\":{},\"global_chart_configuration\":{}}"}

State: 400 BAD REQUEST Response: {"message":{"json_metadata":[{"global_chart_configuration":["Unknown field."]}]}}

ya-msh commented 1 year ago

Encouraging news on this issue! I investigated on this parameter "global_chart_configuration" in the code, and found it 11 times. I tested by commenting some lines in following files:

I know it isn't a lasting change because I have no idea of potential side effects… but it is a good workaround for testing purpose (ability to save dashboard is a pretty useful feature :)). I simply noticed that "Save as" on dashboards doesn't work (with 404 error), however it isn't a critical feature in my case.

Hope it will help to understand and solve root cause…

timon-sue commented 1 year ago

Any further updates on this? I'm also affected by this bug.

doctorseus commented 1 year ago

Same issue. I believe this is broken on at least 2.1.x releases. It does work on master branch, because it looks like the functionality originally removed (I guess around this activity removing global filters https://github.com/apache/superset/pull/23216) was put back in and merged with pull https://github.com/apache/superset/pull/24020.

But I am not sure what the basis of these new 2.1.x releases is, but this stuff missing is certainly affecting these latest "stable" releases.

ya-msh commented 1 year ago

For my part I didn't do anything else since my last message. The workaround I applied still works fine and I didn't notice any side effects. Next step is to upgrade to 3.0.0 release.

rusackas commented 8 months ago

I closed the linked issue (with a lot less conversation than this one) since it's 2.0 specific. Since we no longer support Superset 2.x, I'm tempted to close this one too, but the context here is reasonably recent. Is anyone experiencing this issue in Superset 3.x? Or is anyone willing to open a PR that fixes this for 2.x in case there's some random chance for an opportunistic 2.1.x release (though unlikely)?