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

Cannot convert object to primitive value #309

Open
robross0606 opened this issue Aug 5, 2022 · 1 comment
Open

Cannot convert object to primitive value #309

robross0606 opened this issue Aug 5, 2022 · 1 comment

Comments

@robross0606
Copy link

robross0606 commented Aug 5, 2022

In almanac you have debug lines like this:

(0, _debug2.default)('almanac::constructor initialized runtime fact:' + fact.id + ' with ' + fact.value + '<' + _typeof(fact.value) + '>');

This line does string concatenation on fact.value which seems to also consider passed in params as facts. This basically requires that all passed in params have a toString() function such as what is available in a prototype. However, not all JavaScript variables are guaranteed to have a prototype or a toString() function (e.g. new Object(null)).

For starters, since this appears to be a debug log line, is there a way to disable this entirely? If not, this should be changed to use something like fast-safe-stringify or similar to convert param values to a String form.

@robross0606
Copy link
Author

robross0606 commented Aug 5, 2022

As it happens, Apollo Client response data returns structs with no prototypes so this debug line appears to be preventing us from directly using that response data as a param in rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant