cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.12k stars 3.81k forks source link

Cannot assign to read only property 'schemaInsightType' #103302

Open gtr opened 1 year ago

gtr commented 1 year ago

Describe the problem

A type error was encountered in the insights page.

To Reproduce

The replay isn't available but the error happened on the cluster/insights/ route with the following error:

TypeError: Cannot assign to read only property 'schemaInsightType' of object '#<Object>'
  at ie @ https://cockroachlabs.cloud/assets/admin-ui-22-2.5622f6dbabb9cf5ce2d2.js:1496:11262
  at onClick @ https://cockroachlabs.cloud/assets/admin-ui-22-2.5622f6dbabb9cf5ce2d2.js:1496:11587
  at Object.ni @ https://cockroachlabs.cloud/assets/common.e8e4c759e5a2823aaa26.js:1037:9416
  at jt @ https://cockroachlabs.cloud/assets/common.e8e4c759e5a2823aaa26.js:1037:9579
  at un @ https://cockroachlabs.cloud/assets/common.e8e4c759e5a2823aaa26.js:1037:9642
  at mi @ https://cockroachlabs.cloud/assets/common.e8e4c759e5a2823aaa26.js:1037:29163
  at Ii @ https://cockroachlabs.cloud/assets/common.e8e4c759e5a2823aaa26.js:1037:29624
  at <anonymous> @ https://cockroachlabs.cloud/assets/common.e8e4c759e5a2823aaa26.js:1037:35032
  at Dt @ https://cockroachlabs.cloud/assets/common.e8e4c759e5a2823aaa26.js:1041:19094
  at Nr @ https://cockroachlabs.cloud/assets/common.e8e4c759e5a2823aaa26.js:1037:8567

Based on this and the prettified stack trace, it seems to have been originating from the getSchedules function in schedulesApi.ts.

Additional data / screenshots

Environment:

CockroachDB version: Cockroach Serverless Server OS: Mac OS X 10.15.7

Jira issue: CRDB-27932

maryliag commented 1 year ago

on the log it also shows TypeError: Cannot assign to read only property 'database' of object '#<Object>'

Something is weird with the log because several other logs also point to this same getSchedules function, but that is not used on the Insights page, I think is just a problem with the log showing a wrong line. That function is not even getting called as far as I can see.

xinhaoz commented 1 year ago

From my POV this could be occurring bc we're writing directly to a filters object passed down as props (props should be readonly). I don't see any instances where we write to schemaInsightType field directly, and I couldn't find this error for later versions (this occurred on a 22.2 version). I'm inclined to believe this may not be an issue anymore, but I'm doing some further testing with playing around with setting the filters. So far no errors produced.