Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Object contains forbidden constructor property" error when using specific word #23953

Closed
3 tasks done
kapustor opened this issue May 5, 2023 · 8 comments · Fixed by #25407
Closed
3 tasks done

"Object contains forbidden constructor property" error when using specific word #23953

kapustor opened this issue May 5, 2023 · 8 comments · Fixed by #25407
Labels
#bug Bug report validation:validated A committer has validated / submitted the issue or it was reported by multiple users

Comments

@kapustor
Copy link

kapustor commented May 5, 2023

If I understand it correctly, if a reserved word constructor is used somewhere in returned data, there is a rendering error, both in charts and in the SQL lab. Quite a funny bug if so :)

How to reproduce the bug

  1. Go to 'SQL Lab'
  2. Run a query that returns a string containing constructor. It can be a select from a table or even a simple select of a static string: select 'constructor'

Or, alternatively, create a table containing constructor word in one of the fields, and build a chart from this table that actually shows the constructor word in group by, bar name, column name, etc.

Expected results

The query in SQL Lab will not fail, and the chart will render.

Actual results

You got error Object contains forbidden constructor property

Screenshots

image
image

Environment

  • browser type and version: Chrome 112.0.5615.138
  • superset version: 2.1.0 - SQL Lab error reproduces in 1.5.3, but charts with constructor work in 1.5.3 and don't work in 2.1.0
  • python version: 3.8
  • node.js version: N/A
  • any feature flags active: None

Checklist

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

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

I have searched for similar issue, but found only this that can be related: #22778

@kapustor kapustor added the #bug Bug report label May 5, 2023
@kapustor
Copy link
Author

kapustor commented Sep 4, 2023

Reproduces in 2.1.1.
@sfirke can you please help with this? Looks like a really small issue, but I have no skills to fix it...

@sfirke
Copy link
Member

sfirke commented Sep 4, 2023

I will take a shot at reproducing it this week. It does seem like something that should be a small fix.

@sfirke sfirke added the good first issue Good first issues for new contributors label Sep 4, 2023
@kapustor
Copy link
Author

kapustor commented Sep 4, 2023

Seems like it may be related: opensearch-project/OpenSearch-Dashboards#1777

@kapustor
Copy link
Author

kapustor commented Sep 4, 2023

Also can be related: elastic/elasticsearch-js#1408 (comment)

@sfirke sfirke added the validation:validated A committer has validated / submitted the issue or it was reported by multiple users label Sep 6, 2023
@sfirke
Copy link
Member

sfirke commented Sep 6, 2023

Fixing this is beyond me, but I was able to validate it.

SELECT 'constructor' as [constructor]

Throws this error in SQL Lab for me, while the same query with a different word replacing both instances of "constructor" succeeds.

@sfirke sfirke removed the good first issue Good first issues for new contributors label Sep 6, 2023
@mshustov
Copy link

The problem seems to have been caused by json-bigint library in Superset.
https://github.com/sidorares/json-bigint/blob/3391780b2a3f613bb51536c47e6cddbca31013eb/test/proto-test.js#L38

There is a way to configure them via protoAction property https://github.com/sidorares/json-bigint#optionsprotoaction-boolean-default-error-possible-values-error-ignore-preserve
Which is not used by Superset.

@rusackas
Copy link
Member

Can anyone validate if this is still an issue in Superset 3.x or newer? I assume so. CC @betodealmeida in case there are thoughts about how this is tackled. CC also @SpencerTorres in case you'd like to rebase your PR and see if we can get that across the finish line.

@SpencerTorres
Copy link
Contributor

@rusackas Updated to master and fixed merge conflicts, let me know if anything else needs to be done on that PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#bug Bug report validation:validated A committer has validated / submitted the issue or it was reported by multiple users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants